From a88c6bef4e73e8cf321f8101b55b1a1daa27516b Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Mon, 24 Nov 2025 14:30:57 -0500 Subject: [PATCH 1/9] First full pass at NVML bindings --- .pre-commit-config.yaml | 1 + .../cuda/bindings/_internal/nvml.pxd | 361 + .../cuda/bindings/_internal/nvml_linux.pyx | 7423 +++++ .../cuda/bindings/_internal/nvml_windows.pyx | 6000 ++++ cuda_bindings/cuda/bindings/cufile.pyx | 1597 +- cuda_bindings/cuda/bindings/cycufile.pxd | 81 +- cuda_bindings/cuda/bindings/cynvml.pxd | 2039 ++ cuda_bindings/cuda/bindings/cynvml.pyx | 1403 + cuda_bindings/cuda/bindings/nvml.pxd | 447 + cuda_bindings/cuda/bindings/nvml.pyx | 24200 ++++++++++++++++ cuda_bindings/tests/nvml/README.md | 0 cuda_bindings/tests/nvml/__init__.py | 2 + cuda_bindings/tests/nvml/conftest.py | 118 + cuda_bindings/tests/nvml/test_compute_mode.py | 25 + cuda_bindings/tests/nvml/test_cuda.py | 69 + 15 files changed, 43108 insertions(+), 658 deletions(-) create mode 100644 cuda_bindings/cuda/bindings/_internal/nvml.pxd create mode 100644 cuda_bindings/cuda/bindings/_internal/nvml_linux.pyx create mode 100644 cuda_bindings/cuda/bindings/_internal/nvml_windows.pyx create mode 100644 cuda_bindings/cuda/bindings/cynvml.pxd create mode 100644 cuda_bindings/cuda/bindings/cynvml.pyx create mode 100644 cuda_bindings/cuda/bindings/nvml.pxd create mode 100644 cuda_bindings/cuda/bindings/nvml.pyx create mode 100644 cuda_bindings/tests/nvml/README.md create mode 100644 cuda_bindings/tests/nvml/__init__.py create mode 100644 cuda_bindings/tests/nvml/conftest.py create mode 100644 cuda_bindings/tests/nvml/test_compute_mode.py create mode 100644 cuda_bindings/tests/nvml/test_cuda.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3609d58c21..5c5c4bc641 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -45,6 +45,7 @@ repos: rev: "3e8a8703264a2f4a69428a0aa4dcb512790b2c8c" # frozen: v6.0.0 hooks: - id: check-added-large-files + exclude: cuda_bindings/cuda/bindings/nvml.pyx - id: check-case-conflict - id: check-docstring-first - id: check-merge-conflict diff --git a/cuda_bindings/cuda/bindings/_internal/nvml.pxd b/cuda_bindings/cuda/bindings/_internal/nvml.pxd new file mode 100644 index 0000000000..7f7a987c14 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/nvml.pxd @@ -0,0 +1,361 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE +# +# This code was automatically generated across versions from 12.9.1 to 13.0.1. Do not modify it directly. + +from ..cynvml cimport * + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef nvmlReturn_t _nvmlInit_v2() except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlInitWithFlags(unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlShutdown() except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef const char* _nvmlErrorString(nvmlReturn_t result) except?NULL nogil +cdef nvmlReturn_t _nvmlSystemGetDriverVersion(char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetNVMLVersion(char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetCudaDriverVersion(int* cudaDriverVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetCudaDriverVersion_v2(int* cudaDriverVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetProcessName(unsigned int pid, char* name, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetHicVersion(unsigned int* hwbcCount, nvmlHwbcEntry_t* hwbcEntries) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetTopologyGpuSet(unsigned int cpuNumber, unsigned int* count, nvmlDevice_t* deviceArray) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetDriverBranch(nvmlSystemDriverBranchInfo_t* branchInfo, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlUnitGetCount(unsigned int* unitCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlUnitGetHandleByIndex(unsigned int index, nvmlUnit_t* unit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlUnitGetUnitInfo(nvmlUnit_t unit, nvmlUnitInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlUnitGetLedState(nvmlUnit_t unit, nvmlLedState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlUnitGetPsuInfo(nvmlUnit_t unit, nvmlPSUInfo_t* psu) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlUnitGetTemperature(nvmlUnit_t unit, unsigned int type, unsigned int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlUnitGetFanSpeedInfo(nvmlUnit_t unit, nvmlUnitFanSpeeds_t* fanSpeeds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlUnitGetDevices(nvmlUnit_t unit, unsigned int* deviceCount, nvmlDevice_t* devices) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCount_v2(unsigned int* deviceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetAttributes_v2(nvmlDevice_t device, nvmlDeviceAttributes_t* attributes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetHandleByIndex_v2(unsigned int index, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetHandleBySerial(const char* serial, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetHandleByUUID(const char* uuid, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetHandleByUUIDV(const nvmlUUID_t* uuid, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetHandleByPciBusId_v2(const char* pciBusId, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetName(nvmlDevice_t device, char* name, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetBrand(nvmlDevice_t device, nvmlBrandType_t* type) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetIndex(nvmlDevice_t device, unsigned int* index) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetSerial(nvmlDevice_t device, char* serial, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetModuleId(nvmlDevice_t device, unsigned int* moduleId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetC2cModeInfoV(nvmlDevice_t device, nvmlC2cModeInfo_v1_t* c2cModeInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMemoryAffinity(nvmlDevice_t device, unsigned int nodeSetSize, unsigned long* nodeSet, nvmlAffinityScope_t scope) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCpuAffinityWithinScope(nvmlDevice_t device, unsigned int cpuSetSize, unsigned long* cpuSet, nvmlAffinityScope_t scope) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCpuAffinity(nvmlDevice_t device, unsigned int cpuSetSize, unsigned long* cpuSet) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetCpuAffinity(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceClearCpuAffinity(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNumaNodeId(nvmlDevice_t device, unsigned int* node) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetTopologyCommonAncestor(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuTopologyLevel_t* pathInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetTopologyNearestGpus(nvmlDevice_t device, nvmlGpuTopologyLevel_t level, unsigned int* count, nvmlDevice_t* deviceArray) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetP2PStatus(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuP2PCapsIndex_t p2pIndex, nvmlGpuP2PStatus_t* p2pStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetUUID(nvmlDevice_t device, char* uuid, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMinorNumber(nvmlDevice_t device, unsigned int* minorNumber) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetBoardPartNumber(nvmlDevice_t device, char* partNumber, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetInforomVersion(nvmlDevice_t device, nvmlInforomObject_t object, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetInforomImageVersion(nvmlDevice_t device, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetInforomConfigurationChecksum(nvmlDevice_t device, unsigned int* checksum) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceValidateInforom(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetLastBBXFlushTime(nvmlDevice_t device, unsigned long long* timestamp, unsigned long* durationUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetDisplayMode(nvmlDevice_t device, nvmlEnableState_t* display) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetDisplayActive(nvmlDevice_t device, nvmlEnableState_t* isActive) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPciInfoExt(nvmlDevice_t device, nvmlPciInfoExt_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPciInfo_v3(nvmlDevice_t device, nvmlPciInfo_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMaxPcieLinkGeneration(nvmlDevice_t device, unsigned int* maxLinkGen) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpuMaxPcieLinkGeneration(nvmlDevice_t device, unsigned int* maxLinkGenDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMaxPcieLinkWidth(nvmlDevice_t device, unsigned int* maxLinkWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCurrPcieLinkGeneration(nvmlDevice_t device, unsigned int* currLinkGen) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCurrPcieLinkWidth(nvmlDevice_t device, unsigned int* currLinkWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPcieThroughput(nvmlDevice_t device, nvmlPcieUtilCounter_t counter, unsigned int* value) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPcieReplayCounter(nvmlDevice_t device, unsigned int* value) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMaxClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpcClkVfOffset(nvmlDevice_t device, int* offset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetClock(nvmlDevice_t device, nvmlClockType_t clockType, nvmlClockId_t clockId, unsigned int* clockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMaxCustomerBoostClock(nvmlDevice_t device, nvmlClockType_t clockType, unsigned int* clockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetSupportedMemoryClocks(nvmlDevice_t device, unsigned int* count, unsigned int* clocksMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetSupportedGraphicsClocks(nvmlDevice_t device, unsigned int memoryClockMHz, unsigned int* count, unsigned int* clocksMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t* isEnabled, nvmlEnableState_t* defaultIsEnabled) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetFanSpeed(nvmlDevice_t device, unsigned int* speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetFanSpeed_v2(nvmlDevice_t device, unsigned int fan, unsigned int* speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetFanSpeedRPM(nvmlDevice_t device, nvmlFanSpeedInfo_t* fanSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetTargetFanSpeed(nvmlDevice_t device, unsigned int fan, unsigned int* targetSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMinMaxFanSpeed(nvmlDevice_t device, unsigned int* minSpeed, unsigned int* maxSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetFanControlPolicy_v2(nvmlDevice_t device, unsigned int fan, nvmlFanControlPolicy_t* policy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNumFans(nvmlDevice_t device, unsigned int* numFans) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCoolerInfo(nvmlDevice_t device, nvmlCoolerInfo_t* coolerInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetTemperatureV(nvmlDevice_t device, nvmlTemperature_t* temperature) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetTemperatureThreshold(nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, unsigned int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMarginTemperature(nvmlDevice_t device, nvmlMarginTemperature_t* marginTempInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetThermalSettings(nvmlDevice_t device, unsigned int sensorIndex, nvmlGpuThermalSettings_t* pThermalSettings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPerformanceState(nvmlDevice_t device, nvmlPstates_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCurrentClocksEventReasons(nvmlDevice_t device, unsigned long long* clocksEventReasons) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetSupportedClocksEventReasons(nvmlDevice_t device, unsigned long long* supportedClocksEventReasons) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPowerState(nvmlDevice_t device, nvmlPstates_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetDynamicPstatesInfo(nvmlDevice_t device, nvmlGpuDynamicPstatesInfo_t* pDynamicPstatesInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMemClkVfOffset(nvmlDevice_t device, int* offset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMinMaxClockOfPState(nvmlDevice_t device, nvmlClockType_t type, nvmlPstates_t pstate, unsigned int* minClockMHz, unsigned int* maxClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetSupportedPerformanceStates(nvmlDevice_t device, nvmlPstates_t* pstates, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpcClkMinMaxVfOffset(nvmlDevice_t device, int* minOffset, int* maxOffset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMemClkMinMaxVfOffset(nvmlDevice_t device, int* minOffset, int* maxOffset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetClockOffsets(nvmlDevice_t device, nvmlClockOffset_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetClockOffsets(nvmlDevice_t device, nvmlClockOffset_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPerformanceModes(nvmlDevice_t device, nvmlDevicePerfModes_t* perfModes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCurrentClockFreqs(nvmlDevice_t device, nvmlDeviceCurrentClockFreqs_t* currentClockFreqs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPowerManagementLimit(nvmlDevice_t device, unsigned int* limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPowerManagementLimitConstraints(nvmlDevice_t device, unsigned int* minLimit, unsigned int* maxLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPowerManagementDefaultLimit(nvmlDevice_t device, unsigned int* defaultLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPowerUsage(nvmlDevice_t device, unsigned int* power) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetTotalEnergyConsumption(nvmlDevice_t device, unsigned long long* energy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetEnforcedPowerLimit(nvmlDevice_t device, unsigned int* limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t* current, nvmlGpuOperationMode_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMemoryInfo_v2(nvmlDevice_t device, nvmlMemory_v2_t* memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetComputeMode(nvmlDevice_t device, nvmlComputeMode_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCudaComputeCapability(nvmlDevice_t device, int* major, int* minor) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetDramEncryptionMode(nvmlDevice_t device, nvmlDramEncryptionInfo_t* current, nvmlDramEncryptionInfo_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetDramEncryptionMode(nvmlDevice_t device, const nvmlDramEncryptionInfo_t* dramEncryption) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetEccMode(nvmlDevice_t device, nvmlEnableState_t* current, nvmlEnableState_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetDefaultEccMode(nvmlDevice_t device, nvmlEnableState_t* defaultMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetBoardId(nvmlDevice_t device, unsigned int* boardId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMultiGpuBoard(nvmlDevice_t device, unsigned int* multiGpuBool) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetTotalEccErrors(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, unsigned long long* eccCounts) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMemoryErrorCounter(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, nvmlMemoryLocation_t locationType, unsigned long long* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetUtilizationRates(nvmlDevice_t device, nvmlUtilization_t* utilization) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetEncoderUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetEncoderCapacity(nvmlDevice_t device, nvmlEncoderType_t encoderQueryType, unsigned int* encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetEncoderStats(nvmlDevice_t device, unsigned int* sessionCount, unsigned int* averageFps, unsigned int* averageLatency) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetEncoderSessions(nvmlDevice_t device, unsigned int* sessionCount, nvmlEncoderSessionInfo_t* sessionInfos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetDecoderUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetJpgUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetOfaUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetFBCStats(nvmlDevice_t device, nvmlFBCStats_t* fbcStats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetFBCSessions(nvmlDevice_t device, unsigned int* sessionCount, nvmlFBCSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetDriverModel_v2(nvmlDevice_t device, nvmlDriverModel_t* current, nvmlDriverModel_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVbiosVersion(nvmlDevice_t device, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetBridgeChipInfo(nvmlDevice_t device, nvmlBridgeChipHierarchy_t* bridgeHierarchy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetComputeRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGraphicsRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMPSComputeRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetRunningProcessDetailList(nvmlDevice_t device, nvmlProcessDetailList_t* plist) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceOnSameBoard(nvmlDevice_t device1, nvmlDevice_t device2, int* onSameBoard) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t* isRestricted) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetSamples(nvmlDevice_t device, nvmlSamplingType_t type, unsigned long long lastSeenTimeStamp, nvmlValueType_t* sampleValType, unsigned int* sampleCount, nvmlSample_t* samples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetBAR1MemoryInfo(nvmlDevice_t device, nvmlBAR1Memory_t* bar1Memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetIrqNum(nvmlDevice_t device, unsigned int* irqNum) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNumGpuCores(nvmlDevice_t device, unsigned int* numCores) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPowerSource(nvmlDevice_t device, nvmlPowerSource_t* powerSource) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMemoryBusWidth(nvmlDevice_t device, unsigned int* busWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPcieLinkMaxSpeed(nvmlDevice_t device, unsigned int* maxSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPcieSpeed(nvmlDevice_t device, unsigned int* pcieSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetAdaptiveClockInfoStatus(nvmlDevice_t device, unsigned int* adaptiveClockStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetBusType(nvmlDevice_t device, nvmlBusType_t* type) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpuFabricInfoV(nvmlDevice_t device, nvmlGpuFabricInfoV_t* gpuFabricInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetConfComputeCapabilities(nvmlConfComputeSystemCaps_t* capabilities) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetConfComputeState(nvmlConfComputeSystemState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetConfComputeMemSizeInfo(nvmlDevice_t device, nvmlConfComputeMemSizeInfo_t* memInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetConfComputeGpusReadyState(unsigned int* isAcceptingWork) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetConfComputeProtectedMemoryUsage(nvmlDevice_t device, nvmlMemory_t* memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetConfComputeGpuCertificate(nvmlDevice_t device, nvmlConfComputeGpuCertificate_t* gpuCert) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetConfComputeGpuAttestationReport(nvmlDevice_t device, nvmlConfComputeGpuAttestationReport_t* gpuAtstReport) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetConfComputeKeyRotationThresholdInfo(nvmlConfComputeGetKeyRotationThresholdInfo_t* pKeyRotationThrInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetConfComputeUnprotectedMemSize(nvmlDevice_t device, unsigned long long sizeKiB) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemSetConfComputeGpusReadyState(unsigned int isAcceptingWork) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemSetConfComputeKeyRotationThresholdInfo(nvmlConfComputeSetKeyRotationThresholdInfo_t* pKeyRotationThrInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetConfComputeSettings(nvmlSystemConfComputeSettings_t* settings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGspFirmwareVersion(nvmlDevice_t device, char* version) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGspFirmwareMode(nvmlDevice_t device, unsigned int* isEnabled, unsigned int* defaultMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetSramEccErrorStatus(nvmlDevice_t device, nvmlEccSramErrorStatus_t* status) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetAccountingMode(nvmlDevice_t device, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetAccountingStats(nvmlDevice_t device, unsigned int pid, nvmlAccountingStats_t* stats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetAccountingPids(nvmlDevice_t device, unsigned int* count, unsigned int* pids) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetAccountingBufferSize(nvmlDevice_t device, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetRetiredPages(nvmlDevice_t device, nvmlPageRetirementCause_t cause, unsigned int* pageCount, unsigned long long* addresses) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetRetiredPages_v2(nvmlDevice_t device, nvmlPageRetirementCause_t cause, unsigned int* pageCount, unsigned long long* addresses, unsigned long long* timestamps) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetRetiredPagesPendingStatus(nvmlDevice_t device, nvmlEnableState_t* isPending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetRemappedRows(nvmlDevice_t device, unsigned int* corrRows, unsigned int* uncRows, unsigned int* isPending, unsigned int* failureOccurred) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetRowRemapperHistogram(nvmlDevice_t device, nvmlRowRemapperHistogramValues_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetArchitecture(nvmlDevice_t device, nvmlDeviceArchitecture_t* arch) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetClkMonStatus(nvmlDevice_t device, nvmlClkMonStatus_t* status) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetProcessUtilization(nvmlDevice_t device, nvmlProcessUtilizationSample_t* utilization, unsigned int* processSamplesCount, unsigned long long lastSeenTimeStamp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetProcessesUtilizationInfo(nvmlDevice_t device, nvmlProcessesUtilizationInfo_t* procesesUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPlatformInfo(nvmlDevice_t device, nvmlPlatformInfo_t* platformInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlUnitSetLedState(nvmlUnit_t unit, nvmlLedColor_t color) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetComputeMode(nvmlDevice_t device, nvmlComputeMode_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetEccMode(nvmlDevice_t device, nvmlEnableState_t ecc) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceClearEccErrorCounts(nvmlDevice_t device, nvmlEccCounterType_t counterType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetDriverModel(nvmlDevice_t device, nvmlDriverModel_t driverModel, unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetGpuLockedClocks(nvmlDevice_t device, unsigned int minGpuClockMHz, unsigned int maxGpuClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceResetGpuLockedClocks(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetMemoryLockedClocks(nvmlDevice_t device, unsigned int minMemClockMHz, unsigned int maxMemClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceResetMemoryLockedClocks(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetDefaultAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled, unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetDefaultFanSpeed_v2(nvmlDevice_t device, unsigned int fan) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetFanControlPolicy(nvmlDevice_t device, unsigned int fan, nvmlFanControlPolicy_t policy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetTemperatureThreshold(nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetPowerManagementLimit(nvmlDevice_t device, unsigned int limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t isRestricted) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetFanSpeed_v2(nvmlDevice_t device, unsigned int fan, unsigned int speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetAccountingMode(nvmlDevice_t device, nvmlEnableState_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceClearAccountingPids(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetPowerManagementLimit_v2(nvmlDevice_t device, nvmlPowerValue_v2_t* powerValue) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNvLinkState(nvmlDevice_t device, unsigned int link, nvmlEnableState_t* isActive) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNvLinkVersion(nvmlDevice_t device, unsigned int link, unsigned int* version) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNvLinkCapability(nvmlDevice_t device, unsigned int link, nvmlNvLinkCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNvLinkRemotePciInfo_v2(nvmlDevice_t device, unsigned int link, nvmlPciInfo_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNvLinkErrorCounter(nvmlDevice_t device, unsigned int link, nvmlNvLinkErrorCounter_t counter, unsigned long long* counterValue) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceResetNvLinkErrorCounters(nvmlDevice_t device, unsigned int link) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNvLinkRemoteDeviceType(nvmlDevice_t device, unsigned int link, nvmlIntNvLinkDeviceType_t* pNvLinkDeviceType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetNvLinkDeviceLowPowerThreshold(nvmlDevice_t device, nvmlNvLinkPowerThres_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemSetNvlinkBwMode(unsigned int nvlinkBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetNvlinkBwMode(unsigned int* nvlinkBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNvlinkSupportedBwModes(nvmlDevice_t device, nvmlNvlinkSupportedBwModes_t* supportedBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNvlinkBwMode(nvmlDevice_t device, nvmlNvlinkGetBwMode_t* getBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetNvlinkBwMode(nvmlDevice_t device, nvmlNvlinkSetBwMode_t* setBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlEventSetCreate(nvmlEventSet_t* set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceRegisterEvents(nvmlDevice_t device, unsigned long long eventTypes, nvmlEventSet_t set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetSupportedEventTypes(nvmlDevice_t device, unsigned long long* eventTypes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlEventSetWait_v2(nvmlEventSet_t set, nvmlEventData_t* data, unsigned int timeoutms) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlEventSetFree(nvmlEventSet_t set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemEventSetCreate(nvmlSystemEventSetCreateRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemEventSetFree(nvmlSystemEventSetFreeRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemRegisterEvents(nvmlSystemRegisterEventRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemEventSetWait(nvmlSystemEventSetWaitRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceModifyDrainState(nvmlPciInfo_t* pciInfo, nvmlEnableState_t newState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceQueryDrainState(nvmlPciInfo_t* pciInfo, nvmlEnableState_t* currentState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceRemoveGpu_v2(nvmlPciInfo_t* pciInfo, nvmlDetachGpuState_t gpuState, nvmlPcieLinkState_t linkState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceDiscoverGpus(nvmlPciInfo_t* pciInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetFieldValues(nvmlDevice_t device, int valuesCount, nvmlFieldValue_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceClearFieldValues(nvmlDevice_t device, int valuesCount, nvmlFieldValue_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t* pVirtualMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetHostVgpuMode(nvmlDevice_t device, nvmlHostVgpuMode_t* pHostVgpuMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t virtualMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuHeterogeneousMode(nvmlDevice_t device, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetVgpuHeterogeneousMode(nvmlDevice_t device, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetPlacementId(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuPlacementId_t* pPlacement) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuTypeSupportedPlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuTypeCreatablePlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetGspHeapSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* gspHeapSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetFbReservation(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbReservation) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetRuntimeStateSize(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuRuntimeState_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetVgpuCapabilities(nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, nvmlEnableState_t state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGridLicensableFeatures_v4(nvmlDevice_t device, nvmlGridLicensableFeatures_t* pGridLicensableFeatures) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGetVgpuDriverCapabilities(nvmlVgpuDriverCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuCapabilities(nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetSupportedVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuTypeId_t* vgpuTypeIds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCreatableVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuTypeId_t* vgpuTypeIds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetClass(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeClass, unsigned int* size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetName(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeName, unsigned int* size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetGpuInstanceProfileId(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* gpuInstanceProfileId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetDeviceID(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* deviceID, unsigned long long* subsystemID) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetFramebufferSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetNumDisplayHeads(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* numDisplayHeads) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetResolution(nvmlVgpuTypeId_t vgpuTypeId, unsigned int displayIndex, unsigned int* xdim, unsigned int* ydim) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetLicense(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeLicenseString, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetFrameRateLimit(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* frameRateLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetMaxInstances(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, unsigned int* vgpuInstanceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetMaxInstancesPerVm(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* vgpuInstanceCountPerVm) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetBAR1Info(nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuTypeBar1Info_t* bar1Info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetActiveVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuInstance_t* vgpuInstances) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetVmID(nvmlVgpuInstance_t vgpuInstance, char* vmId, unsigned int size, nvmlVgpuVmIdType_t* vmIdType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetUUID(nvmlVgpuInstance_t vgpuInstance, char* uuid, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetVmDriverVersion(nvmlVgpuInstance_t vgpuInstance, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetFbUsage(nvmlVgpuInstance_t vgpuInstance, unsigned long long* fbUsage) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetLicenseStatus(nvmlVgpuInstance_t vgpuInstance, unsigned int* licensed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetType(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuTypeId_t* vgpuTypeId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetFrameRateLimit(nvmlVgpuInstance_t vgpuInstance, unsigned int* frameRateLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetEccMode(nvmlVgpuInstance_t vgpuInstance, nvmlEnableState_t* eccMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int* encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceSetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetEncoderStats(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, unsigned int* averageFps, unsigned int* averageLatency) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetEncoderSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, nvmlEncoderSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetFBCStats(nvmlVgpuInstance_t vgpuInstance, nvmlFBCStats_t* fbcStats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetFBCSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, nvmlFBCSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetGpuInstanceId(nvmlVgpuInstance_t vgpuInstance, unsigned int* gpuInstanceId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetGpuPciId(nvmlVgpuInstance_t vgpuInstance, char* vgpuPciId, unsigned int* length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetCapabilities(nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetMdevUUID(nvmlVgpuInstance_t vgpuInstance, char* mdevUuid, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetCreatableVgpus(nvmlGpuInstance_t gpuInstance, nvmlVgpuTypeIdInfo_t* pVgpus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetMaxInstancesPerGpuInstance(nvmlVgpuTypeMaxInstance_t* pMaxInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetActiveVgpus(nvmlGpuInstance_t gpuInstance, nvmlActiveVgpuInstanceInfo_t* pVgpuInstanceInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceSetVgpuSchedulerState(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerState_t* pScheduler) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuSchedulerState(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerStateInfo_t* pSchedulerStateInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuSchedulerLog(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerLogInfo_t* pSchedulerLogInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuTypeCreatablePlacements(nvmlGpuInstance_t gpuInstance, nvmlVgpuCreatablePlacementInfo_t* pCreatablePlacementInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuHeterogeneousMode(nvmlGpuInstance_t gpuInstance, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceSetVgpuHeterogeneousMode(nvmlGpuInstance_t gpuInstance, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetMetadata(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuMetadata_t* vgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuMetadata(nvmlDevice_t device, nvmlVgpuPgpuMetadata_t* pgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGetVgpuCompatibility(nvmlVgpuMetadata_t* vgpuMetadata, nvmlVgpuPgpuMetadata_t* pgpuMetadata, nvmlVgpuPgpuCompatibility_t* compatibilityInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPgpuMetadataString(nvmlDevice_t device, char* pgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerLog(nvmlDevice_t device, nvmlVgpuSchedulerLog_t* pSchedulerLog) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerState(nvmlDevice_t device, nvmlVgpuSchedulerGetState_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerCapabilities(nvmlDevice_t device, nvmlVgpuSchedulerCapabilities_t* pCapabilities) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetVgpuSchedulerState(nvmlDevice_t device, nvmlVgpuSchedulerSetState_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGetVgpuVersion(nvmlVgpuVersion_t* supported, nvmlVgpuVersion_t* current) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSetVgpuVersion(nvmlVgpuVersion_t* vgpuVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, nvmlValueType_t* sampleValType, unsigned int* vgpuInstanceSamplesCount, nvmlVgpuInstanceUtilizationSample_t* utilizationSamples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuInstancesUtilizationInfo(nvmlDevice_t device, nvmlVgpuInstancesUtilizationInfo_t* vgpuUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuProcessUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, unsigned int* vgpuProcessSamplesCount, nvmlVgpuProcessUtilizationSample_t* utilizationSamples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuProcessesUtilizationInfo(nvmlDevice_t device, nvmlVgpuProcessesUtilizationInfo_t* vgpuProcUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetAccountingMode(nvmlVgpuInstance_t vgpuInstance, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetAccountingPids(nvmlVgpuInstance_t vgpuInstance, unsigned int* count, unsigned int* pids) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetAccountingStats(nvmlVgpuInstance_t vgpuInstance, unsigned int pid, nvmlAccountingStats_t* stats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceClearAccountingPids(nvmlVgpuInstance_t vgpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetLicenseInfo_v2(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuLicenseInfo_t* licenseInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGetExcludedDeviceCount(unsigned int* deviceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGetExcludedDeviceInfoByIndex(unsigned int index, nvmlExcludedDeviceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetMigMode(nvmlDevice_t device, unsigned int mode, nvmlReturn_t* activationStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMigMode(nvmlDevice_t device, unsigned int* currentMode, unsigned int* pendingMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceProfileInfoV(nvmlDevice_t device, unsigned int profile, nvmlGpuInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpuInstancePossiblePlacements_v2(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstancePlacement_t* placements, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceRemainingCapacity(nvmlDevice_t device, unsigned int profileId, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceCreateGpuInstance(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceCreateGpuInstanceWithPlacement(nvmlDevice_t device, unsigned int profileId, const nvmlGpuInstancePlacement_t* placement, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceDestroy(nvmlGpuInstance_t gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpuInstances(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t* gpuInstances, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceById(nvmlDevice_t device, unsigned int id, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetInfo(nvmlGpuInstance_t gpuInstance, nvmlGpuInstanceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstanceProfileInfoV(nvmlGpuInstance_t gpuInstance, unsigned int profile, unsigned int engProfile, nvmlComputeInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstanceRemainingCapacity(nvmlGpuInstance_t gpuInstance, unsigned int profileId, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstancePossiblePlacements(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstancePlacement_t* placements, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceCreateComputeInstance(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceCreateComputeInstanceWithPlacement(nvmlGpuInstance_t gpuInstance, unsigned int profileId, const nvmlComputeInstancePlacement_t* placement, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlComputeInstanceDestroy(nvmlComputeInstance_t computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstances(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t* computeInstances, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstanceById(nvmlGpuInstance_t gpuInstance, unsigned int id, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlComputeInstanceGetInfo_v2(nvmlComputeInstance_t computeInstance, nvmlComputeInstanceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceIsMigDeviceHandle(nvmlDevice_t device, unsigned int* isMigDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceId(nvmlDevice_t device, unsigned int* id) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetComputeInstanceId(nvmlDevice_t device, unsigned int* id) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMaxMigDeviceCount(nvmlDevice_t device, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMigDeviceHandleByIndex(nvmlDevice_t device, unsigned int index, nvmlDevice_t* migDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetDeviceHandleFromMigDeviceHandle(nvmlDevice_t migDevice, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpmSampleGet(nvmlDevice_t device, nvmlGpmSample_t gpmSample) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpmMigSampleGet(nvmlDevice_t device, unsigned int gpuInstanceId, nvmlGpmSample_t gpmSample) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpmQueryDeviceSupport(nvmlDevice_t device, nvmlGpmSupport_t* gpmSupport) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpmQueryIfStreamingEnabled(nvmlDevice_t device, unsigned int* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpmSetStreamingEnabled(nvmlDevice_t device, unsigned int state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCapabilities(nvmlDevice_t device, nvmlDeviceCapabilities_t* caps) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceWorkloadPowerProfileClearRequestedProfiles(nvmlDevice_t device, nvmlWorkloadPowerProfileRequestedProfiles_t* requestedProfiles) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDevicePowerSmoothingActivatePresetProfile(nvmlDevice_t device, nvmlPowerSmoothingProfile_t* profile) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDevicePowerSmoothingUpdatePresetProfileParam(nvmlDevice_t device, nvmlPowerSmoothingProfile_t* profile) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDevicePowerSmoothingSetState(nvmlDevice_t device, nvmlPowerSmoothingState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetAddressingMode(nvmlDevice_t device, nvmlDeviceAddressingMode_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetRepairStatus(nvmlDevice_t device, nvmlRepairStatus_t* repairStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t* powerMizerMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t* powerMizerMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPdi(nvmlDevice_t device, nvmlPdi_t* pdi) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetHostname_v1(nvmlDevice_t device, nvmlHostname_v1_t* hostname) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetHostname_v1(nvmlDevice_t device, nvmlHostname_v1_t* hostname) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNvLinkInfo(nvmlDevice_t device, nvmlNvLinkInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceReadWritePRM_v1(nvmlDevice_t device, nvmlPRMTLV_v1_t* buffer) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceProfileInfoByIdV(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(nvmlDevice_t device, nvmlEccSramUniqueUncorrectedErrorCounts_t* errorCounts) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil diff --git a/cuda_bindings/cuda/bindings/_internal/nvml_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvml_linux.pyx new file mode 100644 index 0000000000..f047e7da00 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/nvml_linux.pyx @@ -0,0 +1,7423 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE +# +# This code was automatically generated across versions from 12.9.1 to 13.0.1. Do not modify it directly. + +from libc.stdint cimport intptr_t, uintptr_t + +import threading + +from .utils import FunctionNotFoundError, NotSupportedError + +from cuda.pathfinder import load_nvidia_dynamic_lib + + +############################################################################### +# Extern +############################################################################### + +# You must 'from .utils import NotSupportedError' before using this template + +cdef extern from "" nogil: + void* dlopen(const char*, int) + char* dlerror() + void* dlsym(void*, const char*) + int dlclose(void*) + + enum: + RTLD_LAZY + RTLD_NOW + RTLD_GLOBAL + RTLD_LOCAL + + const void* RTLD_DEFAULT 'RTLD_DEFAULT' + +cdef int get_cuda_version(): + cdef void* handle = NULL + cdef int err, driver_ver = 0 + + # Load driver to check version + handle = dlopen('libcuda.so.1', RTLD_NOW | RTLD_GLOBAL) + if handle == NULL: + err_msg = dlerror() + raise NotSupportedError(f'CUDA driver is not found ({err_msg.decode()})') + cuDriverGetVersion = dlsym(handle, "cuDriverGetVersion") + if cuDriverGetVersion == NULL: + raise RuntimeError('Did not find cuDriverGetVersion symbol in libcuda.so.1') + err = (cuDriverGetVersion)(&driver_ver) + if err != 0: + raise RuntimeError(f'cuDriverGetVersion returned error code {err}') + + return driver_ver + + + +############################################################################### +# Wrapper init +############################################################################### + +cdef object __symbol_lock = threading.Lock() +cdef bint __py_nvml_init = False + +cdef void* __nvmlInit_v2 = NULL +cdef void* __nvmlInitWithFlags = NULL +cdef void* __nvmlShutdown = NULL +cdef void* __nvmlErrorString = NULL +cdef void* __nvmlSystemGetDriverVersion = NULL +cdef void* __nvmlSystemGetNVMLVersion = NULL +cdef void* __nvmlSystemGetCudaDriverVersion = NULL +cdef void* __nvmlSystemGetCudaDriverVersion_v2 = NULL +cdef void* __nvmlSystemGetProcessName = NULL +cdef void* __nvmlSystemGetHicVersion = NULL +cdef void* __nvmlSystemGetTopologyGpuSet = NULL +cdef void* __nvmlSystemGetDriverBranch = NULL +cdef void* __nvmlUnitGetCount = NULL +cdef void* __nvmlUnitGetHandleByIndex = NULL +cdef void* __nvmlUnitGetUnitInfo = NULL +cdef void* __nvmlUnitGetLedState = NULL +cdef void* __nvmlUnitGetPsuInfo = NULL +cdef void* __nvmlUnitGetTemperature = NULL +cdef void* __nvmlUnitGetFanSpeedInfo = NULL +cdef void* __nvmlUnitGetDevices = NULL +cdef void* __nvmlDeviceGetCount_v2 = NULL +cdef void* __nvmlDeviceGetAttributes_v2 = NULL +cdef void* __nvmlDeviceGetHandleByIndex_v2 = NULL +cdef void* __nvmlDeviceGetHandleBySerial = NULL +cdef void* __nvmlDeviceGetHandleByUUID = NULL +cdef void* __nvmlDeviceGetHandleByUUIDV = NULL +cdef void* __nvmlDeviceGetHandleByPciBusId_v2 = NULL +cdef void* __nvmlDeviceGetName = NULL +cdef void* __nvmlDeviceGetBrand = NULL +cdef void* __nvmlDeviceGetIndex = NULL +cdef void* __nvmlDeviceGetSerial = NULL +cdef void* __nvmlDeviceGetModuleId = NULL +cdef void* __nvmlDeviceGetC2cModeInfoV = NULL +cdef void* __nvmlDeviceGetMemoryAffinity = NULL +cdef void* __nvmlDeviceGetCpuAffinityWithinScope = NULL +cdef void* __nvmlDeviceGetCpuAffinity = NULL +cdef void* __nvmlDeviceSetCpuAffinity = NULL +cdef void* __nvmlDeviceClearCpuAffinity = NULL +cdef void* __nvmlDeviceGetNumaNodeId = NULL +cdef void* __nvmlDeviceGetTopologyCommonAncestor = NULL +cdef void* __nvmlDeviceGetTopologyNearestGpus = NULL +cdef void* __nvmlDeviceGetP2PStatus = NULL +cdef void* __nvmlDeviceGetUUID = NULL +cdef void* __nvmlDeviceGetMinorNumber = NULL +cdef void* __nvmlDeviceGetBoardPartNumber = NULL +cdef void* __nvmlDeviceGetInforomVersion = NULL +cdef void* __nvmlDeviceGetInforomImageVersion = NULL +cdef void* __nvmlDeviceGetInforomConfigurationChecksum = NULL +cdef void* __nvmlDeviceValidateInforom = NULL +cdef void* __nvmlDeviceGetLastBBXFlushTime = NULL +cdef void* __nvmlDeviceGetDisplayMode = NULL +cdef void* __nvmlDeviceGetDisplayActive = NULL +cdef void* __nvmlDeviceGetPersistenceMode = NULL +cdef void* __nvmlDeviceGetPciInfoExt = NULL +cdef void* __nvmlDeviceGetPciInfo_v3 = NULL +cdef void* __nvmlDeviceGetMaxPcieLinkGeneration = NULL +cdef void* __nvmlDeviceGetGpuMaxPcieLinkGeneration = NULL +cdef void* __nvmlDeviceGetMaxPcieLinkWidth = NULL +cdef void* __nvmlDeviceGetCurrPcieLinkGeneration = NULL +cdef void* __nvmlDeviceGetCurrPcieLinkWidth = NULL +cdef void* __nvmlDeviceGetPcieThroughput = NULL +cdef void* __nvmlDeviceGetPcieReplayCounter = NULL +cdef void* __nvmlDeviceGetClockInfo = NULL +cdef void* __nvmlDeviceGetMaxClockInfo = NULL +cdef void* __nvmlDeviceGetGpcClkVfOffset = NULL +cdef void* __nvmlDeviceGetClock = NULL +cdef void* __nvmlDeviceGetMaxCustomerBoostClock = NULL +cdef void* __nvmlDeviceGetSupportedMemoryClocks = NULL +cdef void* __nvmlDeviceGetSupportedGraphicsClocks = NULL +cdef void* __nvmlDeviceGetAutoBoostedClocksEnabled = NULL +cdef void* __nvmlDeviceGetFanSpeed = NULL +cdef void* __nvmlDeviceGetFanSpeed_v2 = NULL +cdef void* __nvmlDeviceGetFanSpeedRPM = NULL +cdef void* __nvmlDeviceGetTargetFanSpeed = NULL +cdef void* __nvmlDeviceGetMinMaxFanSpeed = NULL +cdef void* __nvmlDeviceGetFanControlPolicy_v2 = NULL +cdef void* __nvmlDeviceGetNumFans = NULL +cdef void* __nvmlDeviceGetCoolerInfo = NULL +cdef void* __nvmlDeviceGetTemperatureV = NULL +cdef void* __nvmlDeviceGetTemperatureThreshold = NULL +cdef void* __nvmlDeviceGetMarginTemperature = NULL +cdef void* __nvmlDeviceGetThermalSettings = NULL +cdef void* __nvmlDeviceGetPerformanceState = NULL +cdef void* __nvmlDeviceGetCurrentClocksEventReasons = NULL +cdef void* __nvmlDeviceGetSupportedClocksEventReasons = NULL +cdef void* __nvmlDeviceGetPowerState = NULL +cdef void* __nvmlDeviceGetDynamicPstatesInfo = NULL +cdef void* __nvmlDeviceGetMemClkVfOffset = NULL +cdef void* __nvmlDeviceGetMinMaxClockOfPState = NULL +cdef void* __nvmlDeviceGetSupportedPerformanceStates = NULL +cdef void* __nvmlDeviceGetGpcClkMinMaxVfOffset = NULL +cdef void* __nvmlDeviceGetMemClkMinMaxVfOffset = NULL +cdef void* __nvmlDeviceGetClockOffsets = NULL +cdef void* __nvmlDeviceSetClockOffsets = NULL +cdef void* __nvmlDeviceGetPerformanceModes = NULL +cdef void* __nvmlDeviceGetCurrentClockFreqs = NULL +cdef void* __nvmlDeviceGetPowerManagementLimit = NULL +cdef void* __nvmlDeviceGetPowerManagementLimitConstraints = NULL +cdef void* __nvmlDeviceGetPowerManagementDefaultLimit = NULL +cdef void* __nvmlDeviceGetPowerUsage = NULL +cdef void* __nvmlDeviceGetTotalEnergyConsumption = NULL +cdef void* __nvmlDeviceGetEnforcedPowerLimit = NULL +cdef void* __nvmlDeviceGetGpuOperationMode = NULL +cdef void* __nvmlDeviceGetMemoryInfo_v2 = NULL +cdef void* __nvmlDeviceGetComputeMode = NULL +cdef void* __nvmlDeviceGetCudaComputeCapability = NULL +cdef void* __nvmlDeviceGetDramEncryptionMode = NULL +cdef void* __nvmlDeviceSetDramEncryptionMode = NULL +cdef void* __nvmlDeviceGetEccMode = NULL +cdef void* __nvmlDeviceGetDefaultEccMode = NULL +cdef void* __nvmlDeviceGetBoardId = NULL +cdef void* __nvmlDeviceGetMultiGpuBoard = NULL +cdef void* __nvmlDeviceGetTotalEccErrors = NULL +cdef void* __nvmlDeviceGetMemoryErrorCounter = NULL +cdef void* __nvmlDeviceGetUtilizationRates = NULL +cdef void* __nvmlDeviceGetEncoderUtilization = NULL +cdef void* __nvmlDeviceGetEncoderCapacity = NULL +cdef void* __nvmlDeviceGetEncoderStats = NULL +cdef void* __nvmlDeviceGetEncoderSessions = NULL +cdef void* __nvmlDeviceGetDecoderUtilization = NULL +cdef void* __nvmlDeviceGetJpgUtilization = NULL +cdef void* __nvmlDeviceGetOfaUtilization = NULL +cdef void* __nvmlDeviceGetFBCStats = NULL +cdef void* __nvmlDeviceGetFBCSessions = NULL +cdef void* __nvmlDeviceGetDriverModel_v2 = NULL +cdef void* __nvmlDeviceGetVbiosVersion = NULL +cdef void* __nvmlDeviceGetBridgeChipInfo = NULL +cdef void* __nvmlDeviceGetComputeRunningProcesses_v3 = NULL +cdef void* __nvmlDeviceGetGraphicsRunningProcesses_v3 = NULL +cdef void* __nvmlDeviceGetMPSComputeRunningProcesses_v3 = NULL +cdef void* __nvmlDeviceGetRunningProcessDetailList = NULL +cdef void* __nvmlDeviceOnSameBoard = NULL +cdef void* __nvmlDeviceGetAPIRestriction = NULL +cdef void* __nvmlDeviceGetSamples = NULL +cdef void* __nvmlDeviceGetBAR1MemoryInfo = NULL +cdef void* __nvmlDeviceGetIrqNum = NULL +cdef void* __nvmlDeviceGetNumGpuCores = NULL +cdef void* __nvmlDeviceGetPowerSource = NULL +cdef void* __nvmlDeviceGetMemoryBusWidth = NULL +cdef void* __nvmlDeviceGetPcieLinkMaxSpeed = NULL +cdef void* __nvmlDeviceGetPcieSpeed = NULL +cdef void* __nvmlDeviceGetAdaptiveClockInfoStatus = NULL +cdef void* __nvmlDeviceGetBusType = NULL +cdef void* __nvmlDeviceGetGpuFabricInfoV = NULL +cdef void* __nvmlSystemGetConfComputeCapabilities = NULL +cdef void* __nvmlSystemGetConfComputeState = NULL +cdef void* __nvmlDeviceGetConfComputeMemSizeInfo = NULL +cdef void* __nvmlSystemGetConfComputeGpusReadyState = NULL +cdef void* __nvmlDeviceGetConfComputeProtectedMemoryUsage = NULL +cdef void* __nvmlDeviceGetConfComputeGpuCertificate = NULL +cdef void* __nvmlDeviceGetConfComputeGpuAttestationReport = NULL +cdef void* __nvmlSystemGetConfComputeKeyRotationThresholdInfo = NULL +cdef void* __nvmlDeviceSetConfComputeUnprotectedMemSize = NULL +cdef void* __nvmlSystemSetConfComputeGpusReadyState = NULL +cdef void* __nvmlSystemSetConfComputeKeyRotationThresholdInfo = NULL +cdef void* __nvmlSystemGetConfComputeSettings = NULL +cdef void* __nvmlDeviceGetGspFirmwareVersion = NULL +cdef void* __nvmlDeviceGetGspFirmwareMode = NULL +cdef void* __nvmlDeviceGetSramEccErrorStatus = NULL +cdef void* __nvmlDeviceGetAccountingMode = NULL +cdef void* __nvmlDeviceGetAccountingStats = NULL +cdef void* __nvmlDeviceGetAccountingPids = NULL +cdef void* __nvmlDeviceGetAccountingBufferSize = NULL +cdef void* __nvmlDeviceGetRetiredPages = NULL +cdef void* __nvmlDeviceGetRetiredPages_v2 = NULL +cdef void* __nvmlDeviceGetRetiredPagesPendingStatus = NULL +cdef void* __nvmlDeviceGetRemappedRows = NULL +cdef void* __nvmlDeviceGetRowRemapperHistogram = NULL +cdef void* __nvmlDeviceGetArchitecture = NULL +cdef void* __nvmlDeviceGetClkMonStatus = NULL +cdef void* __nvmlDeviceGetProcessUtilization = NULL +cdef void* __nvmlDeviceGetProcessesUtilizationInfo = NULL +cdef void* __nvmlDeviceGetPlatformInfo = NULL +cdef void* __nvmlUnitSetLedState = NULL +cdef void* __nvmlDeviceSetPersistenceMode = NULL +cdef void* __nvmlDeviceSetComputeMode = NULL +cdef void* __nvmlDeviceSetEccMode = NULL +cdef void* __nvmlDeviceClearEccErrorCounts = NULL +cdef void* __nvmlDeviceSetDriverModel = NULL +cdef void* __nvmlDeviceSetGpuLockedClocks = NULL +cdef void* __nvmlDeviceResetGpuLockedClocks = NULL +cdef void* __nvmlDeviceSetMemoryLockedClocks = NULL +cdef void* __nvmlDeviceResetMemoryLockedClocks = NULL +cdef void* __nvmlDeviceSetAutoBoostedClocksEnabled = NULL +cdef void* __nvmlDeviceSetDefaultAutoBoostedClocksEnabled = NULL +cdef void* __nvmlDeviceSetDefaultFanSpeed_v2 = NULL +cdef void* __nvmlDeviceSetFanControlPolicy = NULL +cdef void* __nvmlDeviceSetTemperatureThreshold = NULL +cdef void* __nvmlDeviceSetPowerManagementLimit = NULL +cdef void* __nvmlDeviceSetGpuOperationMode = NULL +cdef void* __nvmlDeviceSetAPIRestriction = NULL +cdef void* __nvmlDeviceSetFanSpeed_v2 = NULL +cdef void* __nvmlDeviceSetAccountingMode = NULL +cdef void* __nvmlDeviceClearAccountingPids = NULL +cdef void* __nvmlDeviceSetPowerManagementLimit_v2 = NULL +cdef void* __nvmlDeviceGetNvLinkState = NULL +cdef void* __nvmlDeviceGetNvLinkVersion = NULL +cdef void* __nvmlDeviceGetNvLinkCapability = NULL +cdef void* __nvmlDeviceGetNvLinkRemotePciInfo_v2 = NULL +cdef void* __nvmlDeviceGetNvLinkErrorCounter = NULL +cdef void* __nvmlDeviceResetNvLinkErrorCounters = NULL +cdef void* __nvmlDeviceGetNvLinkRemoteDeviceType = NULL +cdef void* __nvmlDeviceSetNvLinkDeviceLowPowerThreshold = NULL +cdef void* __nvmlSystemSetNvlinkBwMode = NULL +cdef void* __nvmlSystemGetNvlinkBwMode = NULL +cdef void* __nvmlDeviceGetNvlinkSupportedBwModes = NULL +cdef void* __nvmlDeviceGetNvlinkBwMode = NULL +cdef void* __nvmlDeviceSetNvlinkBwMode = NULL +cdef void* __nvmlEventSetCreate = NULL +cdef void* __nvmlDeviceRegisterEvents = NULL +cdef void* __nvmlDeviceGetSupportedEventTypes = NULL +cdef void* __nvmlEventSetWait_v2 = NULL +cdef void* __nvmlEventSetFree = NULL +cdef void* __nvmlSystemEventSetCreate = NULL +cdef void* __nvmlSystemEventSetFree = NULL +cdef void* __nvmlSystemRegisterEvents = NULL +cdef void* __nvmlSystemEventSetWait = NULL +cdef void* __nvmlDeviceModifyDrainState = NULL +cdef void* __nvmlDeviceQueryDrainState = NULL +cdef void* __nvmlDeviceRemoveGpu_v2 = NULL +cdef void* __nvmlDeviceDiscoverGpus = NULL +cdef void* __nvmlDeviceGetFieldValues = NULL +cdef void* __nvmlDeviceClearFieldValues = NULL +cdef void* __nvmlDeviceGetVirtualizationMode = NULL +cdef void* __nvmlDeviceGetHostVgpuMode = NULL +cdef void* __nvmlDeviceSetVirtualizationMode = NULL +cdef void* __nvmlDeviceGetVgpuHeterogeneousMode = NULL +cdef void* __nvmlDeviceSetVgpuHeterogeneousMode = NULL +cdef void* __nvmlVgpuInstanceGetPlacementId = NULL +cdef void* __nvmlDeviceGetVgpuTypeSupportedPlacements = NULL +cdef void* __nvmlDeviceGetVgpuTypeCreatablePlacements = NULL +cdef void* __nvmlVgpuTypeGetGspHeapSize = NULL +cdef void* __nvmlVgpuTypeGetFbReservation = NULL +cdef void* __nvmlVgpuInstanceGetRuntimeStateSize = NULL +cdef void* __nvmlDeviceSetVgpuCapabilities = NULL +cdef void* __nvmlDeviceGetGridLicensableFeatures_v4 = NULL +cdef void* __nvmlGetVgpuDriverCapabilities = NULL +cdef void* __nvmlDeviceGetVgpuCapabilities = NULL +cdef void* __nvmlDeviceGetSupportedVgpus = NULL +cdef void* __nvmlDeviceGetCreatableVgpus = NULL +cdef void* __nvmlVgpuTypeGetClass = NULL +cdef void* __nvmlVgpuTypeGetName = NULL +cdef void* __nvmlVgpuTypeGetGpuInstanceProfileId = NULL +cdef void* __nvmlVgpuTypeGetDeviceID = NULL +cdef void* __nvmlVgpuTypeGetFramebufferSize = NULL +cdef void* __nvmlVgpuTypeGetNumDisplayHeads = NULL +cdef void* __nvmlVgpuTypeGetResolution = NULL +cdef void* __nvmlVgpuTypeGetLicense = NULL +cdef void* __nvmlVgpuTypeGetFrameRateLimit = NULL +cdef void* __nvmlVgpuTypeGetMaxInstances = NULL +cdef void* __nvmlVgpuTypeGetMaxInstancesPerVm = NULL +cdef void* __nvmlVgpuTypeGetBAR1Info = NULL +cdef void* __nvmlDeviceGetActiveVgpus = NULL +cdef void* __nvmlVgpuInstanceGetVmID = NULL +cdef void* __nvmlVgpuInstanceGetUUID = NULL +cdef void* __nvmlVgpuInstanceGetVmDriverVersion = NULL +cdef void* __nvmlVgpuInstanceGetFbUsage = NULL +cdef void* __nvmlVgpuInstanceGetLicenseStatus = NULL +cdef void* __nvmlVgpuInstanceGetType = NULL +cdef void* __nvmlVgpuInstanceGetFrameRateLimit = NULL +cdef void* __nvmlVgpuInstanceGetEccMode = NULL +cdef void* __nvmlVgpuInstanceGetEncoderCapacity = NULL +cdef void* __nvmlVgpuInstanceSetEncoderCapacity = NULL +cdef void* __nvmlVgpuInstanceGetEncoderStats = NULL +cdef void* __nvmlVgpuInstanceGetEncoderSessions = NULL +cdef void* __nvmlVgpuInstanceGetFBCStats = NULL +cdef void* __nvmlVgpuInstanceGetFBCSessions = NULL +cdef void* __nvmlVgpuInstanceGetGpuInstanceId = NULL +cdef void* __nvmlVgpuInstanceGetGpuPciId = NULL +cdef void* __nvmlVgpuTypeGetCapabilities = NULL +cdef void* __nvmlVgpuInstanceGetMdevUUID = NULL +cdef void* __nvmlGpuInstanceGetCreatableVgpus = NULL +cdef void* __nvmlVgpuTypeGetMaxInstancesPerGpuInstance = NULL +cdef void* __nvmlGpuInstanceGetActiveVgpus = NULL +cdef void* __nvmlGpuInstanceSetVgpuSchedulerState = NULL +cdef void* __nvmlGpuInstanceGetVgpuSchedulerState = NULL +cdef void* __nvmlGpuInstanceGetVgpuSchedulerLog = NULL +cdef void* __nvmlGpuInstanceGetVgpuTypeCreatablePlacements = NULL +cdef void* __nvmlGpuInstanceGetVgpuHeterogeneousMode = NULL +cdef void* __nvmlGpuInstanceSetVgpuHeterogeneousMode = NULL +cdef void* __nvmlVgpuInstanceGetMetadata = NULL +cdef void* __nvmlDeviceGetVgpuMetadata = NULL +cdef void* __nvmlGetVgpuCompatibility = NULL +cdef void* __nvmlDeviceGetPgpuMetadataString = NULL +cdef void* __nvmlDeviceGetVgpuSchedulerLog = NULL +cdef void* __nvmlDeviceGetVgpuSchedulerState = NULL +cdef void* __nvmlDeviceGetVgpuSchedulerCapabilities = NULL +cdef void* __nvmlDeviceSetVgpuSchedulerState = NULL +cdef void* __nvmlGetVgpuVersion = NULL +cdef void* __nvmlSetVgpuVersion = NULL +cdef void* __nvmlDeviceGetVgpuUtilization = NULL +cdef void* __nvmlDeviceGetVgpuInstancesUtilizationInfo = NULL +cdef void* __nvmlDeviceGetVgpuProcessUtilization = NULL +cdef void* __nvmlDeviceGetVgpuProcessesUtilizationInfo = NULL +cdef void* __nvmlVgpuInstanceGetAccountingMode = NULL +cdef void* __nvmlVgpuInstanceGetAccountingPids = NULL +cdef void* __nvmlVgpuInstanceGetAccountingStats = NULL +cdef void* __nvmlVgpuInstanceClearAccountingPids = NULL +cdef void* __nvmlVgpuInstanceGetLicenseInfo_v2 = NULL +cdef void* __nvmlGetExcludedDeviceCount = NULL +cdef void* __nvmlGetExcludedDeviceInfoByIndex = NULL +cdef void* __nvmlDeviceSetMigMode = NULL +cdef void* __nvmlDeviceGetMigMode = NULL +cdef void* __nvmlDeviceGetGpuInstanceProfileInfoV = NULL +cdef void* __nvmlDeviceGetGpuInstancePossiblePlacements_v2 = NULL +cdef void* __nvmlDeviceGetGpuInstanceRemainingCapacity = NULL +cdef void* __nvmlDeviceCreateGpuInstance = NULL +cdef void* __nvmlDeviceCreateGpuInstanceWithPlacement = NULL +cdef void* __nvmlGpuInstanceDestroy = NULL +cdef void* __nvmlDeviceGetGpuInstances = NULL +cdef void* __nvmlDeviceGetGpuInstanceById = NULL +cdef void* __nvmlGpuInstanceGetInfo = NULL +cdef void* __nvmlGpuInstanceGetComputeInstanceProfileInfoV = NULL +cdef void* __nvmlGpuInstanceGetComputeInstanceRemainingCapacity = NULL +cdef void* __nvmlGpuInstanceGetComputeInstancePossiblePlacements = NULL +cdef void* __nvmlGpuInstanceCreateComputeInstance = NULL +cdef void* __nvmlGpuInstanceCreateComputeInstanceWithPlacement = NULL +cdef void* __nvmlComputeInstanceDestroy = NULL +cdef void* __nvmlGpuInstanceGetComputeInstances = NULL +cdef void* __nvmlGpuInstanceGetComputeInstanceById = NULL +cdef void* __nvmlComputeInstanceGetInfo_v2 = NULL +cdef void* __nvmlDeviceIsMigDeviceHandle = NULL +cdef void* __nvmlDeviceGetGpuInstanceId = NULL +cdef void* __nvmlDeviceGetComputeInstanceId = NULL +cdef void* __nvmlDeviceGetMaxMigDeviceCount = NULL +cdef void* __nvmlDeviceGetMigDeviceHandleByIndex = NULL +cdef void* __nvmlDeviceGetDeviceHandleFromMigDeviceHandle = NULL +cdef void* __nvmlGpmSampleGet = NULL +cdef void* __nvmlGpmMigSampleGet = NULL +cdef void* __nvmlGpmQueryDeviceSupport = NULL +cdef void* __nvmlGpmQueryIfStreamingEnabled = NULL +cdef void* __nvmlGpmSetStreamingEnabled = NULL +cdef void* __nvmlDeviceGetCapabilities = NULL +cdef void* __nvmlDeviceWorkloadPowerProfileClearRequestedProfiles = NULL +cdef void* __nvmlDevicePowerSmoothingActivatePresetProfile = NULL +cdef void* __nvmlDevicePowerSmoothingUpdatePresetProfileParam = NULL +cdef void* __nvmlDevicePowerSmoothingSetState = NULL +cdef void* __nvmlDeviceGetAddressingMode = NULL +cdef void* __nvmlDeviceGetRepairStatus = NULL +cdef void* __nvmlDeviceGetPowerMizerMode_v1 = NULL +cdef void* __nvmlDeviceSetPowerMizerMode_v1 = NULL +cdef void* __nvmlDeviceGetPdi = NULL +cdef void* __nvmlDeviceSetHostname_v1 = NULL +cdef void* __nvmlDeviceGetHostname_v1 = NULL +cdef void* __nvmlDeviceGetNvLinkInfo = NULL +cdef void* __nvmlDeviceReadWritePRM_v1 = NULL +cdef void* __nvmlDeviceGetGpuInstanceProfileInfoByIdV = NULL +cdef void* __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts = NULL + + +cdef void* load_library() except* with gil: + # TODO: libnvidia-ml.so.1 ships with the driver so is in a different + # location than where pathfinder looks for it + return dlopen("libnvidia-ml.so.1", RTLD_NOW | RTLD_GLOBAL) + + +cdef int _init_nvml() except -1 nogil: + global __py_nvml_init + cdef void* handle = NULL + + with gil, __symbol_lock: + # Recheck the flag after obtaining the locks + if __py_nvml_init: + return 0 + + # Load function + global __nvmlInit_v2 + __nvmlInit_v2 = dlsym(RTLD_DEFAULT, 'nvmlInit_v2') + if __nvmlInit_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlInit_v2 = dlsym(handle, 'nvmlInit_v2') + + global __nvmlInitWithFlags + __nvmlInitWithFlags = dlsym(RTLD_DEFAULT, 'nvmlInitWithFlags') + if __nvmlInitWithFlags == NULL: + if handle == NULL: + handle = load_library() + __nvmlInitWithFlags = dlsym(handle, 'nvmlInitWithFlags') + + global __nvmlShutdown + __nvmlShutdown = dlsym(RTLD_DEFAULT, 'nvmlShutdown') + if __nvmlShutdown == NULL: + if handle == NULL: + handle = load_library() + __nvmlShutdown = dlsym(handle, 'nvmlShutdown') + + global __nvmlErrorString + __nvmlErrorString = dlsym(RTLD_DEFAULT, 'nvmlErrorString') + if __nvmlErrorString == NULL: + if handle == NULL: + handle = load_library() + __nvmlErrorString = dlsym(handle, 'nvmlErrorString') + + global __nvmlSystemGetDriverVersion + __nvmlSystemGetDriverVersion = dlsym(RTLD_DEFAULT, 'nvmlSystemGetDriverVersion') + if __nvmlSystemGetDriverVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetDriverVersion = dlsym(handle, 'nvmlSystemGetDriverVersion') + + global __nvmlSystemGetNVMLVersion + __nvmlSystemGetNVMLVersion = dlsym(RTLD_DEFAULT, 'nvmlSystemGetNVMLVersion') + if __nvmlSystemGetNVMLVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetNVMLVersion = dlsym(handle, 'nvmlSystemGetNVMLVersion') + + global __nvmlSystemGetCudaDriverVersion + __nvmlSystemGetCudaDriverVersion = dlsym(RTLD_DEFAULT, 'nvmlSystemGetCudaDriverVersion') + if __nvmlSystemGetCudaDriverVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetCudaDriverVersion = dlsym(handle, 'nvmlSystemGetCudaDriverVersion') + + global __nvmlSystemGetCudaDriverVersion_v2 + __nvmlSystemGetCudaDriverVersion_v2 = dlsym(RTLD_DEFAULT, 'nvmlSystemGetCudaDriverVersion_v2') + if __nvmlSystemGetCudaDriverVersion_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetCudaDriverVersion_v2 = dlsym(handle, 'nvmlSystemGetCudaDriverVersion_v2') + + global __nvmlSystemGetProcessName + __nvmlSystemGetProcessName = dlsym(RTLD_DEFAULT, 'nvmlSystemGetProcessName') + if __nvmlSystemGetProcessName == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetProcessName = dlsym(handle, 'nvmlSystemGetProcessName') + + global __nvmlSystemGetHicVersion + __nvmlSystemGetHicVersion = dlsym(RTLD_DEFAULT, 'nvmlSystemGetHicVersion') + if __nvmlSystemGetHicVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetHicVersion = dlsym(handle, 'nvmlSystemGetHicVersion') + + global __nvmlSystemGetTopologyGpuSet + __nvmlSystemGetTopologyGpuSet = dlsym(RTLD_DEFAULT, 'nvmlSystemGetTopologyGpuSet') + if __nvmlSystemGetTopologyGpuSet == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetTopologyGpuSet = dlsym(handle, 'nvmlSystemGetTopologyGpuSet') + + global __nvmlSystemGetDriverBranch + __nvmlSystemGetDriverBranch = dlsym(RTLD_DEFAULT, 'nvmlSystemGetDriverBranch') + if __nvmlSystemGetDriverBranch == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetDriverBranch = dlsym(handle, 'nvmlSystemGetDriverBranch') + + global __nvmlUnitGetCount + __nvmlUnitGetCount = dlsym(RTLD_DEFAULT, 'nvmlUnitGetCount') + if __nvmlUnitGetCount == NULL: + if handle == NULL: + handle = load_library() + __nvmlUnitGetCount = dlsym(handle, 'nvmlUnitGetCount') + + global __nvmlUnitGetHandleByIndex + __nvmlUnitGetHandleByIndex = dlsym(RTLD_DEFAULT, 'nvmlUnitGetHandleByIndex') + if __nvmlUnitGetHandleByIndex == NULL: + if handle == NULL: + handle = load_library() + __nvmlUnitGetHandleByIndex = dlsym(handle, 'nvmlUnitGetHandleByIndex') + + global __nvmlUnitGetUnitInfo + __nvmlUnitGetUnitInfo = dlsym(RTLD_DEFAULT, 'nvmlUnitGetUnitInfo') + if __nvmlUnitGetUnitInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlUnitGetUnitInfo = dlsym(handle, 'nvmlUnitGetUnitInfo') + + global __nvmlUnitGetLedState + __nvmlUnitGetLedState = dlsym(RTLD_DEFAULT, 'nvmlUnitGetLedState') + if __nvmlUnitGetLedState == NULL: + if handle == NULL: + handle = load_library() + __nvmlUnitGetLedState = dlsym(handle, 'nvmlUnitGetLedState') + + global __nvmlUnitGetPsuInfo + __nvmlUnitGetPsuInfo = dlsym(RTLD_DEFAULT, 'nvmlUnitGetPsuInfo') + if __nvmlUnitGetPsuInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlUnitGetPsuInfo = dlsym(handle, 'nvmlUnitGetPsuInfo') + + global __nvmlUnitGetTemperature + __nvmlUnitGetTemperature = dlsym(RTLD_DEFAULT, 'nvmlUnitGetTemperature') + if __nvmlUnitGetTemperature == NULL: + if handle == NULL: + handle = load_library() + __nvmlUnitGetTemperature = dlsym(handle, 'nvmlUnitGetTemperature') + + global __nvmlUnitGetFanSpeedInfo + __nvmlUnitGetFanSpeedInfo = dlsym(RTLD_DEFAULT, 'nvmlUnitGetFanSpeedInfo') + if __nvmlUnitGetFanSpeedInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlUnitGetFanSpeedInfo = dlsym(handle, 'nvmlUnitGetFanSpeedInfo') + + global __nvmlUnitGetDevices + __nvmlUnitGetDevices = dlsym(RTLD_DEFAULT, 'nvmlUnitGetDevices') + if __nvmlUnitGetDevices == NULL: + if handle == NULL: + handle = load_library() + __nvmlUnitGetDevices = dlsym(handle, 'nvmlUnitGetDevices') + + global __nvmlDeviceGetCount_v2 + __nvmlDeviceGetCount_v2 = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetCount_v2') + if __nvmlDeviceGetCount_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCount_v2 = dlsym(handle, 'nvmlDeviceGetCount_v2') + + global __nvmlDeviceGetAttributes_v2 + __nvmlDeviceGetAttributes_v2 = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetAttributes_v2') + if __nvmlDeviceGetAttributes_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetAttributes_v2 = dlsym(handle, 'nvmlDeviceGetAttributes_v2') + + global __nvmlDeviceGetHandleByIndex_v2 + __nvmlDeviceGetHandleByIndex_v2 = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetHandleByIndex_v2') + if __nvmlDeviceGetHandleByIndex_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetHandleByIndex_v2 = dlsym(handle, 'nvmlDeviceGetHandleByIndex_v2') + + global __nvmlDeviceGetHandleBySerial + __nvmlDeviceGetHandleBySerial = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetHandleBySerial') + if __nvmlDeviceGetHandleBySerial == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetHandleBySerial = dlsym(handle, 'nvmlDeviceGetHandleBySerial') + + global __nvmlDeviceGetHandleByUUID + __nvmlDeviceGetHandleByUUID = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetHandleByUUID') + if __nvmlDeviceGetHandleByUUID == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetHandleByUUID = dlsym(handle, 'nvmlDeviceGetHandleByUUID') + + global __nvmlDeviceGetHandleByUUIDV + __nvmlDeviceGetHandleByUUIDV = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetHandleByUUIDV') + if __nvmlDeviceGetHandleByUUIDV == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetHandleByUUIDV = dlsym(handle, 'nvmlDeviceGetHandleByUUIDV') + + global __nvmlDeviceGetHandleByPciBusId_v2 + __nvmlDeviceGetHandleByPciBusId_v2 = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetHandleByPciBusId_v2') + if __nvmlDeviceGetHandleByPciBusId_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetHandleByPciBusId_v2 = dlsym(handle, 'nvmlDeviceGetHandleByPciBusId_v2') + + global __nvmlDeviceGetName + __nvmlDeviceGetName = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetName') + if __nvmlDeviceGetName == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetName = dlsym(handle, 'nvmlDeviceGetName') + + global __nvmlDeviceGetBrand + __nvmlDeviceGetBrand = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetBrand') + if __nvmlDeviceGetBrand == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetBrand = dlsym(handle, 'nvmlDeviceGetBrand') + + global __nvmlDeviceGetIndex + __nvmlDeviceGetIndex = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetIndex') + if __nvmlDeviceGetIndex == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetIndex = dlsym(handle, 'nvmlDeviceGetIndex') + + global __nvmlDeviceGetSerial + __nvmlDeviceGetSerial = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetSerial') + if __nvmlDeviceGetSerial == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetSerial = dlsym(handle, 'nvmlDeviceGetSerial') + + global __nvmlDeviceGetModuleId + __nvmlDeviceGetModuleId = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetModuleId') + if __nvmlDeviceGetModuleId == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetModuleId = dlsym(handle, 'nvmlDeviceGetModuleId') + + global __nvmlDeviceGetC2cModeInfoV + __nvmlDeviceGetC2cModeInfoV = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetC2cModeInfoV') + if __nvmlDeviceGetC2cModeInfoV == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetC2cModeInfoV = dlsym(handle, 'nvmlDeviceGetC2cModeInfoV') + + global __nvmlDeviceGetMemoryAffinity + __nvmlDeviceGetMemoryAffinity = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetMemoryAffinity') + if __nvmlDeviceGetMemoryAffinity == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMemoryAffinity = dlsym(handle, 'nvmlDeviceGetMemoryAffinity') + + global __nvmlDeviceGetCpuAffinityWithinScope + __nvmlDeviceGetCpuAffinityWithinScope = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetCpuAffinityWithinScope') + if __nvmlDeviceGetCpuAffinityWithinScope == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCpuAffinityWithinScope = dlsym(handle, 'nvmlDeviceGetCpuAffinityWithinScope') + + global __nvmlDeviceGetCpuAffinity + __nvmlDeviceGetCpuAffinity = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetCpuAffinity') + if __nvmlDeviceGetCpuAffinity == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCpuAffinity = dlsym(handle, 'nvmlDeviceGetCpuAffinity') + + global __nvmlDeviceSetCpuAffinity + __nvmlDeviceSetCpuAffinity = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetCpuAffinity') + if __nvmlDeviceSetCpuAffinity == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetCpuAffinity = dlsym(handle, 'nvmlDeviceSetCpuAffinity') + + global __nvmlDeviceClearCpuAffinity + __nvmlDeviceClearCpuAffinity = dlsym(RTLD_DEFAULT, 'nvmlDeviceClearCpuAffinity') + if __nvmlDeviceClearCpuAffinity == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceClearCpuAffinity = dlsym(handle, 'nvmlDeviceClearCpuAffinity') + + global __nvmlDeviceGetNumaNodeId + __nvmlDeviceGetNumaNodeId = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetNumaNodeId') + if __nvmlDeviceGetNumaNodeId == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNumaNodeId = dlsym(handle, 'nvmlDeviceGetNumaNodeId') + + global __nvmlDeviceGetTopologyCommonAncestor + __nvmlDeviceGetTopologyCommonAncestor = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetTopologyCommonAncestor') + if __nvmlDeviceGetTopologyCommonAncestor == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetTopologyCommonAncestor = dlsym(handle, 'nvmlDeviceGetTopologyCommonAncestor') + + global __nvmlDeviceGetTopologyNearestGpus + __nvmlDeviceGetTopologyNearestGpus = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetTopologyNearestGpus') + if __nvmlDeviceGetTopologyNearestGpus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetTopologyNearestGpus = dlsym(handle, 'nvmlDeviceGetTopologyNearestGpus') + + global __nvmlDeviceGetP2PStatus + __nvmlDeviceGetP2PStatus = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetP2PStatus') + if __nvmlDeviceGetP2PStatus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetP2PStatus = dlsym(handle, 'nvmlDeviceGetP2PStatus') + + global __nvmlDeviceGetUUID + __nvmlDeviceGetUUID = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetUUID') + if __nvmlDeviceGetUUID == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetUUID = dlsym(handle, 'nvmlDeviceGetUUID') + + global __nvmlDeviceGetMinorNumber + __nvmlDeviceGetMinorNumber = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetMinorNumber') + if __nvmlDeviceGetMinorNumber == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMinorNumber = dlsym(handle, 'nvmlDeviceGetMinorNumber') + + global __nvmlDeviceGetBoardPartNumber + __nvmlDeviceGetBoardPartNumber = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetBoardPartNumber') + if __nvmlDeviceGetBoardPartNumber == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetBoardPartNumber = dlsym(handle, 'nvmlDeviceGetBoardPartNumber') + + global __nvmlDeviceGetInforomVersion + __nvmlDeviceGetInforomVersion = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetInforomVersion') + if __nvmlDeviceGetInforomVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetInforomVersion = dlsym(handle, 'nvmlDeviceGetInforomVersion') + + global __nvmlDeviceGetInforomImageVersion + __nvmlDeviceGetInforomImageVersion = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetInforomImageVersion') + if __nvmlDeviceGetInforomImageVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetInforomImageVersion = dlsym(handle, 'nvmlDeviceGetInforomImageVersion') + + global __nvmlDeviceGetInforomConfigurationChecksum + __nvmlDeviceGetInforomConfigurationChecksum = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetInforomConfigurationChecksum') + if __nvmlDeviceGetInforomConfigurationChecksum == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetInforomConfigurationChecksum = dlsym(handle, 'nvmlDeviceGetInforomConfigurationChecksum') + + global __nvmlDeviceValidateInforom + __nvmlDeviceValidateInforom = dlsym(RTLD_DEFAULT, 'nvmlDeviceValidateInforom') + if __nvmlDeviceValidateInforom == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceValidateInforom = dlsym(handle, 'nvmlDeviceValidateInforom') + + global __nvmlDeviceGetLastBBXFlushTime + __nvmlDeviceGetLastBBXFlushTime = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetLastBBXFlushTime') + if __nvmlDeviceGetLastBBXFlushTime == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetLastBBXFlushTime = dlsym(handle, 'nvmlDeviceGetLastBBXFlushTime') + + global __nvmlDeviceGetDisplayMode + __nvmlDeviceGetDisplayMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetDisplayMode') + if __nvmlDeviceGetDisplayMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetDisplayMode = dlsym(handle, 'nvmlDeviceGetDisplayMode') + + global __nvmlDeviceGetDisplayActive + __nvmlDeviceGetDisplayActive = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetDisplayActive') + if __nvmlDeviceGetDisplayActive == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetDisplayActive = dlsym(handle, 'nvmlDeviceGetDisplayActive') + + global __nvmlDeviceGetPersistenceMode + __nvmlDeviceGetPersistenceMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetPersistenceMode') + if __nvmlDeviceGetPersistenceMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPersistenceMode = dlsym(handle, 'nvmlDeviceGetPersistenceMode') + + global __nvmlDeviceGetPciInfoExt + __nvmlDeviceGetPciInfoExt = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetPciInfoExt') + if __nvmlDeviceGetPciInfoExt == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPciInfoExt = dlsym(handle, 'nvmlDeviceGetPciInfoExt') + + global __nvmlDeviceGetPciInfo_v3 + __nvmlDeviceGetPciInfo_v3 = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetPciInfo_v3') + if __nvmlDeviceGetPciInfo_v3 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPciInfo_v3 = dlsym(handle, 'nvmlDeviceGetPciInfo_v3') + + global __nvmlDeviceGetMaxPcieLinkGeneration + __nvmlDeviceGetMaxPcieLinkGeneration = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetMaxPcieLinkGeneration') + if __nvmlDeviceGetMaxPcieLinkGeneration == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMaxPcieLinkGeneration = dlsym(handle, 'nvmlDeviceGetMaxPcieLinkGeneration') + + global __nvmlDeviceGetGpuMaxPcieLinkGeneration + __nvmlDeviceGetGpuMaxPcieLinkGeneration = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetGpuMaxPcieLinkGeneration') + if __nvmlDeviceGetGpuMaxPcieLinkGeneration == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpuMaxPcieLinkGeneration = dlsym(handle, 'nvmlDeviceGetGpuMaxPcieLinkGeneration') + + global __nvmlDeviceGetMaxPcieLinkWidth + __nvmlDeviceGetMaxPcieLinkWidth = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetMaxPcieLinkWidth') + if __nvmlDeviceGetMaxPcieLinkWidth == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMaxPcieLinkWidth = dlsym(handle, 'nvmlDeviceGetMaxPcieLinkWidth') + + global __nvmlDeviceGetCurrPcieLinkGeneration + __nvmlDeviceGetCurrPcieLinkGeneration = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetCurrPcieLinkGeneration') + if __nvmlDeviceGetCurrPcieLinkGeneration == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCurrPcieLinkGeneration = dlsym(handle, 'nvmlDeviceGetCurrPcieLinkGeneration') + + global __nvmlDeviceGetCurrPcieLinkWidth + __nvmlDeviceGetCurrPcieLinkWidth = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetCurrPcieLinkWidth') + if __nvmlDeviceGetCurrPcieLinkWidth == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCurrPcieLinkWidth = dlsym(handle, 'nvmlDeviceGetCurrPcieLinkWidth') + + global __nvmlDeviceGetPcieThroughput + __nvmlDeviceGetPcieThroughput = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetPcieThroughput') + if __nvmlDeviceGetPcieThroughput == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPcieThroughput = dlsym(handle, 'nvmlDeviceGetPcieThroughput') + + global __nvmlDeviceGetPcieReplayCounter + __nvmlDeviceGetPcieReplayCounter = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetPcieReplayCounter') + if __nvmlDeviceGetPcieReplayCounter == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPcieReplayCounter = dlsym(handle, 'nvmlDeviceGetPcieReplayCounter') + + global __nvmlDeviceGetClockInfo + __nvmlDeviceGetClockInfo = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetClockInfo') + if __nvmlDeviceGetClockInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetClockInfo = dlsym(handle, 'nvmlDeviceGetClockInfo') + + global __nvmlDeviceGetMaxClockInfo + __nvmlDeviceGetMaxClockInfo = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetMaxClockInfo') + if __nvmlDeviceGetMaxClockInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMaxClockInfo = dlsym(handle, 'nvmlDeviceGetMaxClockInfo') + + global __nvmlDeviceGetGpcClkVfOffset + __nvmlDeviceGetGpcClkVfOffset = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetGpcClkVfOffset') + if __nvmlDeviceGetGpcClkVfOffset == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpcClkVfOffset = dlsym(handle, 'nvmlDeviceGetGpcClkVfOffset') + + global __nvmlDeviceGetClock + __nvmlDeviceGetClock = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetClock') + if __nvmlDeviceGetClock == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetClock = dlsym(handle, 'nvmlDeviceGetClock') + + global __nvmlDeviceGetMaxCustomerBoostClock + __nvmlDeviceGetMaxCustomerBoostClock = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetMaxCustomerBoostClock') + if __nvmlDeviceGetMaxCustomerBoostClock == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMaxCustomerBoostClock = dlsym(handle, 'nvmlDeviceGetMaxCustomerBoostClock') + + global __nvmlDeviceGetSupportedMemoryClocks + __nvmlDeviceGetSupportedMemoryClocks = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetSupportedMemoryClocks') + if __nvmlDeviceGetSupportedMemoryClocks == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetSupportedMemoryClocks = dlsym(handle, 'nvmlDeviceGetSupportedMemoryClocks') + + global __nvmlDeviceGetSupportedGraphicsClocks + __nvmlDeviceGetSupportedGraphicsClocks = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetSupportedGraphicsClocks') + if __nvmlDeviceGetSupportedGraphicsClocks == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetSupportedGraphicsClocks = dlsym(handle, 'nvmlDeviceGetSupportedGraphicsClocks') + + global __nvmlDeviceGetAutoBoostedClocksEnabled + __nvmlDeviceGetAutoBoostedClocksEnabled = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetAutoBoostedClocksEnabled') + if __nvmlDeviceGetAutoBoostedClocksEnabled == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetAutoBoostedClocksEnabled = dlsym(handle, 'nvmlDeviceGetAutoBoostedClocksEnabled') + + global __nvmlDeviceGetFanSpeed + __nvmlDeviceGetFanSpeed = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetFanSpeed') + if __nvmlDeviceGetFanSpeed == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetFanSpeed = dlsym(handle, 'nvmlDeviceGetFanSpeed') + + global __nvmlDeviceGetFanSpeed_v2 + __nvmlDeviceGetFanSpeed_v2 = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetFanSpeed_v2') + if __nvmlDeviceGetFanSpeed_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetFanSpeed_v2 = dlsym(handle, 'nvmlDeviceGetFanSpeed_v2') + + global __nvmlDeviceGetFanSpeedRPM + __nvmlDeviceGetFanSpeedRPM = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetFanSpeedRPM') + if __nvmlDeviceGetFanSpeedRPM == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetFanSpeedRPM = dlsym(handle, 'nvmlDeviceGetFanSpeedRPM') + + global __nvmlDeviceGetTargetFanSpeed + __nvmlDeviceGetTargetFanSpeed = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetTargetFanSpeed') + if __nvmlDeviceGetTargetFanSpeed == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetTargetFanSpeed = dlsym(handle, 'nvmlDeviceGetTargetFanSpeed') + + global __nvmlDeviceGetMinMaxFanSpeed + __nvmlDeviceGetMinMaxFanSpeed = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetMinMaxFanSpeed') + if __nvmlDeviceGetMinMaxFanSpeed == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMinMaxFanSpeed = dlsym(handle, 'nvmlDeviceGetMinMaxFanSpeed') + + global __nvmlDeviceGetFanControlPolicy_v2 + __nvmlDeviceGetFanControlPolicy_v2 = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetFanControlPolicy_v2') + if __nvmlDeviceGetFanControlPolicy_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetFanControlPolicy_v2 = dlsym(handle, 'nvmlDeviceGetFanControlPolicy_v2') + + global __nvmlDeviceGetNumFans + __nvmlDeviceGetNumFans = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetNumFans') + if __nvmlDeviceGetNumFans == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNumFans = dlsym(handle, 'nvmlDeviceGetNumFans') + + global __nvmlDeviceGetCoolerInfo + __nvmlDeviceGetCoolerInfo = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetCoolerInfo') + if __nvmlDeviceGetCoolerInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCoolerInfo = dlsym(handle, 'nvmlDeviceGetCoolerInfo') + + global __nvmlDeviceGetTemperatureV + __nvmlDeviceGetTemperatureV = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetTemperatureV') + if __nvmlDeviceGetTemperatureV == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetTemperatureV = dlsym(handle, 'nvmlDeviceGetTemperatureV') + + global __nvmlDeviceGetTemperatureThreshold + __nvmlDeviceGetTemperatureThreshold = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetTemperatureThreshold') + if __nvmlDeviceGetTemperatureThreshold == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetTemperatureThreshold = dlsym(handle, 'nvmlDeviceGetTemperatureThreshold') + + global __nvmlDeviceGetMarginTemperature + __nvmlDeviceGetMarginTemperature = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetMarginTemperature') + if __nvmlDeviceGetMarginTemperature == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMarginTemperature = dlsym(handle, 'nvmlDeviceGetMarginTemperature') + + global __nvmlDeviceGetThermalSettings + __nvmlDeviceGetThermalSettings = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetThermalSettings') + if __nvmlDeviceGetThermalSettings == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetThermalSettings = dlsym(handle, 'nvmlDeviceGetThermalSettings') + + global __nvmlDeviceGetPerformanceState + __nvmlDeviceGetPerformanceState = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetPerformanceState') + if __nvmlDeviceGetPerformanceState == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPerformanceState = dlsym(handle, 'nvmlDeviceGetPerformanceState') + + global __nvmlDeviceGetCurrentClocksEventReasons + __nvmlDeviceGetCurrentClocksEventReasons = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetCurrentClocksEventReasons') + if __nvmlDeviceGetCurrentClocksEventReasons == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCurrentClocksEventReasons = dlsym(handle, 'nvmlDeviceGetCurrentClocksEventReasons') + + global __nvmlDeviceGetSupportedClocksEventReasons + __nvmlDeviceGetSupportedClocksEventReasons = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetSupportedClocksEventReasons') + if __nvmlDeviceGetSupportedClocksEventReasons == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetSupportedClocksEventReasons = dlsym(handle, 'nvmlDeviceGetSupportedClocksEventReasons') + + global __nvmlDeviceGetPowerState + __nvmlDeviceGetPowerState = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetPowerState') + if __nvmlDeviceGetPowerState == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPowerState = dlsym(handle, 'nvmlDeviceGetPowerState') + + global __nvmlDeviceGetDynamicPstatesInfo + __nvmlDeviceGetDynamicPstatesInfo = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetDynamicPstatesInfo') + if __nvmlDeviceGetDynamicPstatesInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetDynamicPstatesInfo = dlsym(handle, 'nvmlDeviceGetDynamicPstatesInfo') + + global __nvmlDeviceGetMemClkVfOffset + __nvmlDeviceGetMemClkVfOffset = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetMemClkVfOffset') + if __nvmlDeviceGetMemClkVfOffset == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMemClkVfOffset = dlsym(handle, 'nvmlDeviceGetMemClkVfOffset') + + global __nvmlDeviceGetMinMaxClockOfPState + __nvmlDeviceGetMinMaxClockOfPState = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetMinMaxClockOfPState') + if __nvmlDeviceGetMinMaxClockOfPState == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMinMaxClockOfPState = dlsym(handle, 'nvmlDeviceGetMinMaxClockOfPState') + + global __nvmlDeviceGetSupportedPerformanceStates + __nvmlDeviceGetSupportedPerformanceStates = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetSupportedPerformanceStates') + if __nvmlDeviceGetSupportedPerformanceStates == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetSupportedPerformanceStates = dlsym(handle, 'nvmlDeviceGetSupportedPerformanceStates') + + global __nvmlDeviceGetGpcClkMinMaxVfOffset + __nvmlDeviceGetGpcClkMinMaxVfOffset = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetGpcClkMinMaxVfOffset') + if __nvmlDeviceGetGpcClkMinMaxVfOffset == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpcClkMinMaxVfOffset = dlsym(handle, 'nvmlDeviceGetGpcClkMinMaxVfOffset') + + global __nvmlDeviceGetMemClkMinMaxVfOffset + __nvmlDeviceGetMemClkMinMaxVfOffset = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetMemClkMinMaxVfOffset') + if __nvmlDeviceGetMemClkMinMaxVfOffset == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMemClkMinMaxVfOffset = dlsym(handle, 'nvmlDeviceGetMemClkMinMaxVfOffset') + + global __nvmlDeviceGetClockOffsets + __nvmlDeviceGetClockOffsets = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetClockOffsets') + if __nvmlDeviceGetClockOffsets == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetClockOffsets = dlsym(handle, 'nvmlDeviceGetClockOffsets') + + global __nvmlDeviceSetClockOffsets + __nvmlDeviceSetClockOffsets = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetClockOffsets') + if __nvmlDeviceSetClockOffsets == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetClockOffsets = dlsym(handle, 'nvmlDeviceSetClockOffsets') + + global __nvmlDeviceGetPerformanceModes + __nvmlDeviceGetPerformanceModes = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetPerformanceModes') + if __nvmlDeviceGetPerformanceModes == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPerformanceModes = dlsym(handle, 'nvmlDeviceGetPerformanceModes') + + global __nvmlDeviceGetCurrentClockFreqs + __nvmlDeviceGetCurrentClockFreqs = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetCurrentClockFreqs') + if __nvmlDeviceGetCurrentClockFreqs == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCurrentClockFreqs = dlsym(handle, 'nvmlDeviceGetCurrentClockFreqs') + + global __nvmlDeviceGetPowerManagementLimit + __nvmlDeviceGetPowerManagementLimit = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetPowerManagementLimit') + if __nvmlDeviceGetPowerManagementLimit == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPowerManagementLimit = dlsym(handle, 'nvmlDeviceGetPowerManagementLimit') + + global __nvmlDeviceGetPowerManagementLimitConstraints + __nvmlDeviceGetPowerManagementLimitConstraints = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetPowerManagementLimitConstraints') + if __nvmlDeviceGetPowerManagementLimitConstraints == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPowerManagementLimitConstraints = dlsym(handle, 'nvmlDeviceGetPowerManagementLimitConstraints') + + global __nvmlDeviceGetPowerManagementDefaultLimit + __nvmlDeviceGetPowerManagementDefaultLimit = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetPowerManagementDefaultLimit') + if __nvmlDeviceGetPowerManagementDefaultLimit == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPowerManagementDefaultLimit = dlsym(handle, 'nvmlDeviceGetPowerManagementDefaultLimit') + + global __nvmlDeviceGetPowerUsage + __nvmlDeviceGetPowerUsage = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetPowerUsage') + if __nvmlDeviceGetPowerUsage == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPowerUsage = dlsym(handle, 'nvmlDeviceGetPowerUsage') + + global __nvmlDeviceGetTotalEnergyConsumption + __nvmlDeviceGetTotalEnergyConsumption = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetTotalEnergyConsumption') + if __nvmlDeviceGetTotalEnergyConsumption == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetTotalEnergyConsumption = dlsym(handle, 'nvmlDeviceGetTotalEnergyConsumption') + + global __nvmlDeviceGetEnforcedPowerLimit + __nvmlDeviceGetEnforcedPowerLimit = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetEnforcedPowerLimit') + if __nvmlDeviceGetEnforcedPowerLimit == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetEnforcedPowerLimit = dlsym(handle, 'nvmlDeviceGetEnforcedPowerLimit') + + global __nvmlDeviceGetGpuOperationMode + __nvmlDeviceGetGpuOperationMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetGpuOperationMode') + if __nvmlDeviceGetGpuOperationMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpuOperationMode = dlsym(handle, 'nvmlDeviceGetGpuOperationMode') + + global __nvmlDeviceGetMemoryInfo_v2 + __nvmlDeviceGetMemoryInfo_v2 = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetMemoryInfo_v2') + if __nvmlDeviceGetMemoryInfo_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMemoryInfo_v2 = dlsym(handle, 'nvmlDeviceGetMemoryInfo_v2') + + global __nvmlDeviceGetComputeMode + __nvmlDeviceGetComputeMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetComputeMode') + if __nvmlDeviceGetComputeMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetComputeMode = dlsym(handle, 'nvmlDeviceGetComputeMode') + + global __nvmlDeviceGetCudaComputeCapability + __nvmlDeviceGetCudaComputeCapability = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetCudaComputeCapability') + if __nvmlDeviceGetCudaComputeCapability == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCudaComputeCapability = dlsym(handle, 'nvmlDeviceGetCudaComputeCapability') + + global __nvmlDeviceGetDramEncryptionMode + __nvmlDeviceGetDramEncryptionMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetDramEncryptionMode') + if __nvmlDeviceGetDramEncryptionMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetDramEncryptionMode = dlsym(handle, 'nvmlDeviceGetDramEncryptionMode') + + global __nvmlDeviceSetDramEncryptionMode + __nvmlDeviceSetDramEncryptionMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetDramEncryptionMode') + if __nvmlDeviceSetDramEncryptionMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetDramEncryptionMode = dlsym(handle, 'nvmlDeviceSetDramEncryptionMode') + + global __nvmlDeviceGetEccMode + __nvmlDeviceGetEccMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetEccMode') + if __nvmlDeviceGetEccMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetEccMode = dlsym(handle, 'nvmlDeviceGetEccMode') + + global __nvmlDeviceGetDefaultEccMode + __nvmlDeviceGetDefaultEccMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetDefaultEccMode') + if __nvmlDeviceGetDefaultEccMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetDefaultEccMode = dlsym(handle, 'nvmlDeviceGetDefaultEccMode') + + global __nvmlDeviceGetBoardId + __nvmlDeviceGetBoardId = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetBoardId') + if __nvmlDeviceGetBoardId == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetBoardId = dlsym(handle, 'nvmlDeviceGetBoardId') + + global __nvmlDeviceGetMultiGpuBoard + __nvmlDeviceGetMultiGpuBoard = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetMultiGpuBoard') + if __nvmlDeviceGetMultiGpuBoard == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMultiGpuBoard = dlsym(handle, 'nvmlDeviceGetMultiGpuBoard') + + global __nvmlDeviceGetTotalEccErrors + __nvmlDeviceGetTotalEccErrors = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetTotalEccErrors') + if __nvmlDeviceGetTotalEccErrors == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetTotalEccErrors = dlsym(handle, 'nvmlDeviceGetTotalEccErrors') + + global __nvmlDeviceGetMemoryErrorCounter + __nvmlDeviceGetMemoryErrorCounter = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetMemoryErrorCounter') + if __nvmlDeviceGetMemoryErrorCounter == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMemoryErrorCounter = dlsym(handle, 'nvmlDeviceGetMemoryErrorCounter') + + global __nvmlDeviceGetUtilizationRates + __nvmlDeviceGetUtilizationRates = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetUtilizationRates') + if __nvmlDeviceGetUtilizationRates == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetUtilizationRates = dlsym(handle, 'nvmlDeviceGetUtilizationRates') + + global __nvmlDeviceGetEncoderUtilization + __nvmlDeviceGetEncoderUtilization = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetEncoderUtilization') + if __nvmlDeviceGetEncoderUtilization == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetEncoderUtilization = dlsym(handle, 'nvmlDeviceGetEncoderUtilization') + + global __nvmlDeviceGetEncoderCapacity + __nvmlDeviceGetEncoderCapacity = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetEncoderCapacity') + if __nvmlDeviceGetEncoderCapacity == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetEncoderCapacity = dlsym(handle, 'nvmlDeviceGetEncoderCapacity') + + global __nvmlDeviceGetEncoderStats + __nvmlDeviceGetEncoderStats = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetEncoderStats') + if __nvmlDeviceGetEncoderStats == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetEncoderStats = dlsym(handle, 'nvmlDeviceGetEncoderStats') + + global __nvmlDeviceGetEncoderSessions + __nvmlDeviceGetEncoderSessions = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetEncoderSessions') + if __nvmlDeviceGetEncoderSessions == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetEncoderSessions = dlsym(handle, 'nvmlDeviceGetEncoderSessions') + + global __nvmlDeviceGetDecoderUtilization + __nvmlDeviceGetDecoderUtilization = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetDecoderUtilization') + if __nvmlDeviceGetDecoderUtilization == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetDecoderUtilization = dlsym(handle, 'nvmlDeviceGetDecoderUtilization') + + global __nvmlDeviceGetJpgUtilization + __nvmlDeviceGetJpgUtilization = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetJpgUtilization') + if __nvmlDeviceGetJpgUtilization == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetJpgUtilization = dlsym(handle, 'nvmlDeviceGetJpgUtilization') + + global __nvmlDeviceGetOfaUtilization + __nvmlDeviceGetOfaUtilization = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetOfaUtilization') + if __nvmlDeviceGetOfaUtilization == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetOfaUtilization = dlsym(handle, 'nvmlDeviceGetOfaUtilization') + + global __nvmlDeviceGetFBCStats + __nvmlDeviceGetFBCStats = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetFBCStats') + if __nvmlDeviceGetFBCStats == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetFBCStats = dlsym(handle, 'nvmlDeviceGetFBCStats') + + global __nvmlDeviceGetFBCSessions + __nvmlDeviceGetFBCSessions = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetFBCSessions') + if __nvmlDeviceGetFBCSessions == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetFBCSessions = dlsym(handle, 'nvmlDeviceGetFBCSessions') + + global __nvmlDeviceGetDriverModel_v2 + __nvmlDeviceGetDriverModel_v2 = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetDriverModel_v2') + if __nvmlDeviceGetDriverModel_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetDriverModel_v2 = dlsym(handle, 'nvmlDeviceGetDriverModel_v2') + + global __nvmlDeviceGetVbiosVersion + __nvmlDeviceGetVbiosVersion = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetVbiosVersion') + if __nvmlDeviceGetVbiosVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVbiosVersion = dlsym(handle, 'nvmlDeviceGetVbiosVersion') + + global __nvmlDeviceGetBridgeChipInfo + __nvmlDeviceGetBridgeChipInfo = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetBridgeChipInfo') + if __nvmlDeviceGetBridgeChipInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetBridgeChipInfo = dlsym(handle, 'nvmlDeviceGetBridgeChipInfo') + + global __nvmlDeviceGetComputeRunningProcesses_v3 + __nvmlDeviceGetComputeRunningProcesses_v3 = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetComputeRunningProcesses_v3') + if __nvmlDeviceGetComputeRunningProcesses_v3 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetComputeRunningProcesses_v3 = dlsym(handle, 'nvmlDeviceGetComputeRunningProcesses_v3') + + global __nvmlDeviceGetGraphicsRunningProcesses_v3 + __nvmlDeviceGetGraphicsRunningProcesses_v3 = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetGraphicsRunningProcesses_v3') + if __nvmlDeviceGetGraphicsRunningProcesses_v3 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGraphicsRunningProcesses_v3 = dlsym(handle, 'nvmlDeviceGetGraphicsRunningProcesses_v3') + + global __nvmlDeviceGetMPSComputeRunningProcesses_v3 + __nvmlDeviceGetMPSComputeRunningProcesses_v3 = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetMPSComputeRunningProcesses_v3') + if __nvmlDeviceGetMPSComputeRunningProcesses_v3 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMPSComputeRunningProcesses_v3 = dlsym(handle, 'nvmlDeviceGetMPSComputeRunningProcesses_v3') + + global __nvmlDeviceGetRunningProcessDetailList + __nvmlDeviceGetRunningProcessDetailList = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetRunningProcessDetailList') + if __nvmlDeviceGetRunningProcessDetailList == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetRunningProcessDetailList = dlsym(handle, 'nvmlDeviceGetRunningProcessDetailList') + + global __nvmlDeviceOnSameBoard + __nvmlDeviceOnSameBoard = dlsym(RTLD_DEFAULT, 'nvmlDeviceOnSameBoard') + if __nvmlDeviceOnSameBoard == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceOnSameBoard = dlsym(handle, 'nvmlDeviceOnSameBoard') + + global __nvmlDeviceGetAPIRestriction + __nvmlDeviceGetAPIRestriction = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetAPIRestriction') + if __nvmlDeviceGetAPIRestriction == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetAPIRestriction = dlsym(handle, 'nvmlDeviceGetAPIRestriction') + + global __nvmlDeviceGetSamples + __nvmlDeviceGetSamples = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetSamples') + if __nvmlDeviceGetSamples == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetSamples = dlsym(handle, 'nvmlDeviceGetSamples') + + global __nvmlDeviceGetBAR1MemoryInfo + __nvmlDeviceGetBAR1MemoryInfo = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetBAR1MemoryInfo') + if __nvmlDeviceGetBAR1MemoryInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetBAR1MemoryInfo = dlsym(handle, 'nvmlDeviceGetBAR1MemoryInfo') + + global __nvmlDeviceGetIrqNum + __nvmlDeviceGetIrqNum = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetIrqNum') + if __nvmlDeviceGetIrqNum == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetIrqNum = dlsym(handle, 'nvmlDeviceGetIrqNum') + + global __nvmlDeviceGetNumGpuCores + __nvmlDeviceGetNumGpuCores = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetNumGpuCores') + if __nvmlDeviceGetNumGpuCores == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNumGpuCores = dlsym(handle, 'nvmlDeviceGetNumGpuCores') + + global __nvmlDeviceGetPowerSource + __nvmlDeviceGetPowerSource = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetPowerSource') + if __nvmlDeviceGetPowerSource == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPowerSource = dlsym(handle, 'nvmlDeviceGetPowerSource') + + global __nvmlDeviceGetMemoryBusWidth + __nvmlDeviceGetMemoryBusWidth = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetMemoryBusWidth') + if __nvmlDeviceGetMemoryBusWidth == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMemoryBusWidth = dlsym(handle, 'nvmlDeviceGetMemoryBusWidth') + + global __nvmlDeviceGetPcieLinkMaxSpeed + __nvmlDeviceGetPcieLinkMaxSpeed = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetPcieLinkMaxSpeed') + if __nvmlDeviceGetPcieLinkMaxSpeed == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPcieLinkMaxSpeed = dlsym(handle, 'nvmlDeviceGetPcieLinkMaxSpeed') + + global __nvmlDeviceGetPcieSpeed + __nvmlDeviceGetPcieSpeed = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetPcieSpeed') + if __nvmlDeviceGetPcieSpeed == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPcieSpeed = dlsym(handle, 'nvmlDeviceGetPcieSpeed') + + global __nvmlDeviceGetAdaptiveClockInfoStatus + __nvmlDeviceGetAdaptiveClockInfoStatus = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetAdaptiveClockInfoStatus') + if __nvmlDeviceGetAdaptiveClockInfoStatus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetAdaptiveClockInfoStatus = dlsym(handle, 'nvmlDeviceGetAdaptiveClockInfoStatus') + + global __nvmlDeviceGetBusType + __nvmlDeviceGetBusType = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetBusType') + if __nvmlDeviceGetBusType == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetBusType = dlsym(handle, 'nvmlDeviceGetBusType') + + global __nvmlDeviceGetGpuFabricInfoV + __nvmlDeviceGetGpuFabricInfoV = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetGpuFabricInfoV') + if __nvmlDeviceGetGpuFabricInfoV == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpuFabricInfoV = dlsym(handle, 'nvmlDeviceGetGpuFabricInfoV') + + global __nvmlSystemGetConfComputeCapabilities + __nvmlSystemGetConfComputeCapabilities = dlsym(RTLD_DEFAULT, 'nvmlSystemGetConfComputeCapabilities') + if __nvmlSystemGetConfComputeCapabilities == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetConfComputeCapabilities = dlsym(handle, 'nvmlSystemGetConfComputeCapabilities') + + global __nvmlSystemGetConfComputeState + __nvmlSystemGetConfComputeState = dlsym(RTLD_DEFAULT, 'nvmlSystemGetConfComputeState') + if __nvmlSystemGetConfComputeState == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetConfComputeState = dlsym(handle, 'nvmlSystemGetConfComputeState') + + global __nvmlDeviceGetConfComputeMemSizeInfo + __nvmlDeviceGetConfComputeMemSizeInfo = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetConfComputeMemSizeInfo') + if __nvmlDeviceGetConfComputeMemSizeInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetConfComputeMemSizeInfo = dlsym(handle, 'nvmlDeviceGetConfComputeMemSizeInfo') + + global __nvmlSystemGetConfComputeGpusReadyState + __nvmlSystemGetConfComputeGpusReadyState = dlsym(RTLD_DEFAULT, 'nvmlSystemGetConfComputeGpusReadyState') + if __nvmlSystemGetConfComputeGpusReadyState == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetConfComputeGpusReadyState = dlsym(handle, 'nvmlSystemGetConfComputeGpusReadyState') + + global __nvmlDeviceGetConfComputeProtectedMemoryUsage + __nvmlDeviceGetConfComputeProtectedMemoryUsage = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetConfComputeProtectedMemoryUsage') + if __nvmlDeviceGetConfComputeProtectedMemoryUsage == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetConfComputeProtectedMemoryUsage = dlsym(handle, 'nvmlDeviceGetConfComputeProtectedMemoryUsage') + + global __nvmlDeviceGetConfComputeGpuCertificate + __nvmlDeviceGetConfComputeGpuCertificate = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetConfComputeGpuCertificate') + if __nvmlDeviceGetConfComputeGpuCertificate == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetConfComputeGpuCertificate = dlsym(handle, 'nvmlDeviceGetConfComputeGpuCertificate') + + global __nvmlDeviceGetConfComputeGpuAttestationReport + __nvmlDeviceGetConfComputeGpuAttestationReport = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetConfComputeGpuAttestationReport') + if __nvmlDeviceGetConfComputeGpuAttestationReport == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetConfComputeGpuAttestationReport = dlsym(handle, 'nvmlDeviceGetConfComputeGpuAttestationReport') + + global __nvmlSystemGetConfComputeKeyRotationThresholdInfo + __nvmlSystemGetConfComputeKeyRotationThresholdInfo = dlsym(RTLD_DEFAULT, 'nvmlSystemGetConfComputeKeyRotationThresholdInfo') + if __nvmlSystemGetConfComputeKeyRotationThresholdInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetConfComputeKeyRotationThresholdInfo = dlsym(handle, 'nvmlSystemGetConfComputeKeyRotationThresholdInfo') + + global __nvmlDeviceSetConfComputeUnprotectedMemSize + __nvmlDeviceSetConfComputeUnprotectedMemSize = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetConfComputeUnprotectedMemSize') + if __nvmlDeviceSetConfComputeUnprotectedMemSize == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetConfComputeUnprotectedMemSize = dlsym(handle, 'nvmlDeviceSetConfComputeUnprotectedMemSize') + + global __nvmlSystemSetConfComputeGpusReadyState + __nvmlSystemSetConfComputeGpusReadyState = dlsym(RTLD_DEFAULT, 'nvmlSystemSetConfComputeGpusReadyState') + if __nvmlSystemSetConfComputeGpusReadyState == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemSetConfComputeGpusReadyState = dlsym(handle, 'nvmlSystemSetConfComputeGpusReadyState') + + global __nvmlSystemSetConfComputeKeyRotationThresholdInfo + __nvmlSystemSetConfComputeKeyRotationThresholdInfo = dlsym(RTLD_DEFAULT, 'nvmlSystemSetConfComputeKeyRotationThresholdInfo') + if __nvmlSystemSetConfComputeKeyRotationThresholdInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemSetConfComputeKeyRotationThresholdInfo = dlsym(handle, 'nvmlSystemSetConfComputeKeyRotationThresholdInfo') + + global __nvmlSystemGetConfComputeSettings + __nvmlSystemGetConfComputeSettings = dlsym(RTLD_DEFAULT, 'nvmlSystemGetConfComputeSettings') + if __nvmlSystemGetConfComputeSettings == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetConfComputeSettings = dlsym(handle, 'nvmlSystemGetConfComputeSettings') + + global __nvmlDeviceGetGspFirmwareVersion + __nvmlDeviceGetGspFirmwareVersion = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetGspFirmwareVersion') + if __nvmlDeviceGetGspFirmwareVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGspFirmwareVersion = dlsym(handle, 'nvmlDeviceGetGspFirmwareVersion') + + global __nvmlDeviceGetGspFirmwareMode + __nvmlDeviceGetGspFirmwareMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetGspFirmwareMode') + if __nvmlDeviceGetGspFirmwareMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGspFirmwareMode = dlsym(handle, 'nvmlDeviceGetGspFirmwareMode') + + global __nvmlDeviceGetSramEccErrorStatus + __nvmlDeviceGetSramEccErrorStatus = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetSramEccErrorStatus') + if __nvmlDeviceGetSramEccErrorStatus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetSramEccErrorStatus = dlsym(handle, 'nvmlDeviceGetSramEccErrorStatus') + + global __nvmlDeviceGetAccountingMode + __nvmlDeviceGetAccountingMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetAccountingMode') + if __nvmlDeviceGetAccountingMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetAccountingMode = dlsym(handle, 'nvmlDeviceGetAccountingMode') + + global __nvmlDeviceGetAccountingStats + __nvmlDeviceGetAccountingStats = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetAccountingStats') + if __nvmlDeviceGetAccountingStats == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetAccountingStats = dlsym(handle, 'nvmlDeviceGetAccountingStats') + + global __nvmlDeviceGetAccountingPids + __nvmlDeviceGetAccountingPids = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetAccountingPids') + if __nvmlDeviceGetAccountingPids == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetAccountingPids = dlsym(handle, 'nvmlDeviceGetAccountingPids') + + global __nvmlDeviceGetAccountingBufferSize + __nvmlDeviceGetAccountingBufferSize = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetAccountingBufferSize') + if __nvmlDeviceGetAccountingBufferSize == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetAccountingBufferSize = dlsym(handle, 'nvmlDeviceGetAccountingBufferSize') + + global __nvmlDeviceGetRetiredPages + __nvmlDeviceGetRetiredPages = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetRetiredPages') + if __nvmlDeviceGetRetiredPages == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetRetiredPages = dlsym(handle, 'nvmlDeviceGetRetiredPages') + + global __nvmlDeviceGetRetiredPages_v2 + __nvmlDeviceGetRetiredPages_v2 = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetRetiredPages_v2') + if __nvmlDeviceGetRetiredPages_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetRetiredPages_v2 = dlsym(handle, 'nvmlDeviceGetRetiredPages_v2') + + global __nvmlDeviceGetRetiredPagesPendingStatus + __nvmlDeviceGetRetiredPagesPendingStatus = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetRetiredPagesPendingStatus') + if __nvmlDeviceGetRetiredPagesPendingStatus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetRetiredPagesPendingStatus = dlsym(handle, 'nvmlDeviceGetRetiredPagesPendingStatus') + + global __nvmlDeviceGetRemappedRows + __nvmlDeviceGetRemappedRows = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetRemappedRows') + if __nvmlDeviceGetRemappedRows == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetRemappedRows = dlsym(handle, 'nvmlDeviceGetRemappedRows') + + global __nvmlDeviceGetRowRemapperHistogram + __nvmlDeviceGetRowRemapperHistogram = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetRowRemapperHistogram') + if __nvmlDeviceGetRowRemapperHistogram == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetRowRemapperHistogram = dlsym(handle, 'nvmlDeviceGetRowRemapperHistogram') + + global __nvmlDeviceGetArchitecture + __nvmlDeviceGetArchitecture = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetArchitecture') + if __nvmlDeviceGetArchitecture == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetArchitecture = dlsym(handle, 'nvmlDeviceGetArchitecture') + + global __nvmlDeviceGetClkMonStatus + __nvmlDeviceGetClkMonStatus = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetClkMonStatus') + if __nvmlDeviceGetClkMonStatus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetClkMonStatus = dlsym(handle, 'nvmlDeviceGetClkMonStatus') + + global __nvmlDeviceGetProcessUtilization + __nvmlDeviceGetProcessUtilization = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetProcessUtilization') + if __nvmlDeviceGetProcessUtilization == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetProcessUtilization = dlsym(handle, 'nvmlDeviceGetProcessUtilization') + + global __nvmlDeviceGetProcessesUtilizationInfo + __nvmlDeviceGetProcessesUtilizationInfo = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetProcessesUtilizationInfo') + if __nvmlDeviceGetProcessesUtilizationInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetProcessesUtilizationInfo = dlsym(handle, 'nvmlDeviceGetProcessesUtilizationInfo') + + global __nvmlDeviceGetPlatformInfo + __nvmlDeviceGetPlatformInfo = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetPlatformInfo') + if __nvmlDeviceGetPlatformInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPlatformInfo = dlsym(handle, 'nvmlDeviceGetPlatformInfo') + + global __nvmlUnitSetLedState + __nvmlUnitSetLedState = dlsym(RTLD_DEFAULT, 'nvmlUnitSetLedState') + if __nvmlUnitSetLedState == NULL: + if handle == NULL: + handle = load_library() + __nvmlUnitSetLedState = dlsym(handle, 'nvmlUnitSetLedState') + + global __nvmlDeviceSetPersistenceMode + __nvmlDeviceSetPersistenceMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetPersistenceMode') + if __nvmlDeviceSetPersistenceMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetPersistenceMode = dlsym(handle, 'nvmlDeviceSetPersistenceMode') + + global __nvmlDeviceSetComputeMode + __nvmlDeviceSetComputeMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetComputeMode') + if __nvmlDeviceSetComputeMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetComputeMode = dlsym(handle, 'nvmlDeviceSetComputeMode') + + global __nvmlDeviceSetEccMode + __nvmlDeviceSetEccMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetEccMode') + if __nvmlDeviceSetEccMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetEccMode = dlsym(handle, 'nvmlDeviceSetEccMode') + + global __nvmlDeviceClearEccErrorCounts + __nvmlDeviceClearEccErrorCounts = dlsym(RTLD_DEFAULT, 'nvmlDeviceClearEccErrorCounts') + if __nvmlDeviceClearEccErrorCounts == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceClearEccErrorCounts = dlsym(handle, 'nvmlDeviceClearEccErrorCounts') + + global __nvmlDeviceSetDriverModel + __nvmlDeviceSetDriverModel = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetDriverModel') + if __nvmlDeviceSetDriverModel == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetDriverModel = dlsym(handle, 'nvmlDeviceSetDriverModel') + + global __nvmlDeviceSetGpuLockedClocks + __nvmlDeviceSetGpuLockedClocks = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetGpuLockedClocks') + if __nvmlDeviceSetGpuLockedClocks == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetGpuLockedClocks = dlsym(handle, 'nvmlDeviceSetGpuLockedClocks') + + global __nvmlDeviceResetGpuLockedClocks + __nvmlDeviceResetGpuLockedClocks = dlsym(RTLD_DEFAULT, 'nvmlDeviceResetGpuLockedClocks') + if __nvmlDeviceResetGpuLockedClocks == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceResetGpuLockedClocks = dlsym(handle, 'nvmlDeviceResetGpuLockedClocks') + + global __nvmlDeviceSetMemoryLockedClocks + __nvmlDeviceSetMemoryLockedClocks = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetMemoryLockedClocks') + if __nvmlDeviceSetMemoryLockedClocks == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetMemoryLockedClocks = dlsym(handle, 'nvmlDeviceSetMemoryLockedClocks') + + global __nvmlDeviceResetMemoryLockedClocks + __nvmlDeviceResetMemoryLockedClocks = dlsym(RTLD_DEFAULT, 'nvmlDeviceResetMemoryLockedClocks') + if __nvmlDeviceResetMemoryLockedClocks == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceResetMemoryLockedClocks = dlsym(handle, 'nvmlDeviceResetMemoryLockedClocks') + + global __nvmlDeviceSetAutoBoostedClocksEnabled + __nvmlDeviceSetAutoBoostedClocksEnabled = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetAutoBoostedClocksEnabled') + if __nvmlDeviceSetAutoBoostedClocksEnabled == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetAutoBoostedClocksEnabled = dlsym(handle, 'nvmlDeviceSetAutoBoostedClocksEnabled') + + global __nvmlDeviceSetDefaultAutoBoostedClocksEnabled + __nvmlDeviceSetDefaultAutoBoostedClocksEnabled = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetDefaultAutoBoostedClocksEnabled') + if __nvmlDeviceSetDefaultAutoBoostedClocksEnabled == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetDefaultAutoBoostedClocksEnabled = dlsym(handle, 'nvmlDeviceSetDefaultAutoBoostedClocksEnabled') + + global __nvmlDeviceSetDefaultFanSpeed_v2 + __nvmlDeviceSetDefaultFanSpeed_v2 = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetDefaultFanSpeed_v2') + if __nvmlDeviceSetDefaultFanSpeed_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetDefaultFanSpeed_v2 = dlsym(handle, 'nvmlDeviceSetDefaultFanSpeed_v2') + + global __nvmlDeviceSetFanControlPolicy + __nvmlDeviceSetFanControlPolicy = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetFanControlPolicy') + if __nvmlDeviceSetFanControlPolicy == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetFanControlPolicy = dlsym(handle, 'nvmlDeviceSetFanControlPolicy') + + global __nvmlDeviceSetTemperatureThreshold + __nvmlDeviceSetTemperatureThreshold = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetTemperatureThreshold') + if __nvmlDeviceSetTemperatureThreshold == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetTemperatureThreshold = dlsym(handle, 'nvmlDeviceSetTemperatureThreshold') + + global __nvmlDeviceSetPowerManagementLimit + __nvmlDeviceSetPowerManagementLimit = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetPowerManagementLimit') + if __nvmlDeviceSetPowerManagementLimit == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetPowerManagementLimit = dlsym(handle, 'nvmlDeviceSetPowerManagementLimit') + + global __nvmlDeviceSetGpuOperationMode + __nvmlDeviceSetGpuOperationMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetGpuOperationMode') + if __nvmlDeviceSetGpuOperationMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetGpuOperationMode = dlsym(handle, 'nvmlDeviceSetGpuOperationMode') + + global __nvmlDeviceSetAPIRestriction + __nvmlDeviceSetAPIRestriction = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetAPIRestriction') + if __nvmlDeviceSetAPIRestriction == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetAPIRestriction = dlsym(handle, 'nvmlDeviceSetAPIRestriction') + + global __nvmlDeviceSetFanSpeed_v2 + __nvmlDeviceSetFanSpeed_v2 = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetFanSpeed_v2') + if __nvmlDeviceSetFanSpeed_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetFanSpeed_v2 = dlsym(handle, 'nvmlDeviceSetFanSpeed_v2') + + global __nvmlDeviceSetAccountingMode + __nvmlDeviceSetAccountingMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetAccountingMode') + if __nvmlDeviceSetAccountingMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetAccountingMode = dlsym(handle, 'nvmlDeviceSetAccountingMode') + + global __nvmlDeviceClearAccountingPids + __nvmlDeviceClearAccountingPids = dlsym(RTLD_DEFAULT, 'nvmlDeviceClearAccountingPids') + if __nvmlDeviceClearAccountingPids == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceClearAccountingPids = dlsym(handle, 'nvmlDeviceClearAccountingPids') + + global __nvmlDeviceSetPowerManagementLimit_v2 + __nvmlDeviceSetPowerManagementLimit_v2 = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetPowerManagementLimit_v2') + if __nvmlDeviceSetPowerManagementLimit_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetPowerManagementLimit_v2 = dlsym(handle, 'nvmlDeviceSetPowerManagementLimit_v2') + + global __nvmlDeviceGetNvLinkState + __nvmlDeviceGetNvLinkState = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetNvLinkState') + if __nvmlDeviceGetNvLinkState == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNvLinkState = dlsym(handle, 'nvmlDeviceGetNvLinkState') + + global __nvmlDeviceGetNvLinkVersion + __nvmlDeviceGetNvLinkVersion = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetNvLinkVersion') + if __nvmlDeviceGetNvLinkVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNvLinkVersion = dlsym(handle, 'nvmlDeviceGetNvLinkVersion') + + global __nvmlDeviceGetNvLinkCapability + __nvmlDeviceGetNvLinkCapability = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetNvLinkCapability') + if __nvmlDeviceGetNvLinkCapability == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNvLinkCapability = dlsym(handle, 'nvmlDeviceGetNvLinkCapability') + + global __nvmlDeviceGetNvLinkRemotePciInfo_v2 + __nvmlDeviceGetNvLinkRemotePciInfo_v2 = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetNvLinkRemotePciInfo_v2') + if __nvmlDeviceGetNvLinkRemotePciInfo_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNvLinkRemotePciInfo_v2 = dlsym(handle, 'nvmlDeviceGetNvLinkRemotePciInfo_v2') + + global __nvmlDeviceGetNvLinkErrorCounter + __nvmlDeviceGetNvLinkErrorCounter = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetNvLinkErrorCounter') + if __nvmlDeviceGetNvLinkErrorCounter == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNvLinkErrorCounter = dlsym(handle, 'nvmlDeviceGetNvLinkErrorCounter') + + global __nvmlDeviceResetNvLinkErrorCounters + __nvmlDeviceResetNvLinkErrorCounters = dlsym(RTLD_DEFAULT, 'nvmlDeviceResetNvLinkErrorCounters') + if __nvmlDeviceResetNvLinkErrorCounters == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceResetNvLinkErrorCounters = dlsym(handle, 'nvmlDeviceResetNvLinkErrorCounters') + + global __nvmlDeviceGetNvLinkRemoteDeviceType + __nvmlDeviceGetNvLinkRemoteDeviceType = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetNvLinkRemoteDeviceType') + if __nvmlDeviceGetNvLinkRemoteDeviceType == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNvLinkRemoteDeviceType = dlsym(handle, 'nvmlDeviceGetNvLinkRemoteDeviceType') + + global __nvmlDeviceSetNvLinkDeviceLowPowerThreshold + __nvmlDeviceSetNvLinkDeviceLowPowerThreshold = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetNvLinkDeviceLowPowerThreshold') + if __nvmlDeviceSetNvLinkDeviceLowPowerThreshold == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetNvLinkDeviceLowPowerThreshold = dlsym(handle, 'nvmlDeviceSetNvLinkDeviceLowPowerThreshold') + + global __nvmlSystemSetNvlinkBwMode + __nvmlSystemSetNvlinkBwMode = dlsym(RTLD_DEFAULT, 'nvmlSystemSetNvlinkBwMode') + if __nvmlSystemSetNvlinkBwMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemSetNvlinkBwMode = dlsym(handle, 'nvmlSystemSetNvlinkBwMode') + + global __nvmlSystemGetNvlinkBwMode + __nvmlSystemGetNvlinkBwMode = dlsym(RTLD_DEFAULT, 'nvmlSystemGetNvlinkBwMode') + if __nvmlSystemGetNvlinkBwMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetNvlinkBwMode = dlsym(handle, 'nvmlSystemGetNvlinkBwMode') + + global __nvmlDeviceGetNvlinkSupportedBwModes + __nvmlDeviceGetNvlinkSupportedBwModes = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetNvlinkSupportedBwModes') + if __nvmlDeviceGetNvlinkSupportedBwModes == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNvlinkSupportedBwModes = dlsym(handle, 'nvmlDeviceGetNvlinkSupportedBwModes') + + global __nvmlDeviceGetNvlinkBwMode + __nvmlDeviceGetNvlinkBwMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetNvlinkBwMode') + if __nvmlDeviceGetNvlinkBwMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNvlinkBwMode = dlsym(handle, 'nvmlDeviceGetNvlinkBwMode') + + global __nvmlDeviceSetNvlinkBwMode + __nvmlDeviceSetNvlinkBwMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetNvlinkBwMode') + if __nvmlDeviceSetNvlinkBwMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetNvlinkBwMode = dlsym(handle, 'nvmlDeviceSetNvlinkBwMode') + + global __nvmlEventSetCreate + __nvmlEventSetCreate = dlsym(RTLD_DEFAULT, 'nvmlEventSetCreate') + if __nvmlEventSetCreate == NULL: + if handle == NULL: + handle = load_library() + __nvmlEventSetCreate = dlsym(handle, 'nvmlEventSetCreate') + + global __nvmlDeviceRegisterEvents + __nvmlDeviceRegisterEvents = dlsym(RTLD_DEFAULT, 'nvmlDeviceRegisterEvents') + if __nvmlDeviceRegisterEvents == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceRegisterEvents = dlsym(handle, 'nvmlDeviceRegisterEvents') + + global __nvmlDeviceGetSupportedEventTypes + __nvmlDeviceGetSupportedEventTypes = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetSupportedEventTypes') + if __nvmlDeviceGetSupportedEventTypes == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetSupportedEventTypes = dlsym(handle, 'nvmlDeviceGetSupportedEventTypes') + + global __nvmlEventSetWait_v2 + __nvmlEventSetWait_v2 = dlsym(RTLD_DEFAULT, 'nvmlEventSetWait_v2') + if __nvmlEventSetWait_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlEventSetWait_v2 = dlsym(handle, 'nvmlEventSetWait_v2') + + global __nvmlEventSetFree + __nvmlEventSetFree = dlsym(RTLD_DEFAULT, 'nvmlEventSetFree') + if __nvmlEventSetFree == NULL: + if handle == NULL: + handle = load_library() + __nvmlEventSetFree = dlsym(handle, 'nvmlEventSetFree') + + global __nvmlSystemEventSetCreate + __nvmlSystemEventSetCreate = dlsym(RTLD_DEFAULT, 'nvmlSystemEventSetCreate') + if __nvmlSystemEventSetCreate == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemEventSetCreate = dlsym(handle, 'nvmlSystemEventSetCreate') + + global __nvmlSystemEventSetFree + __nvmlSystemEventSetFree = dlsym(RTLD_DEFAULT, 'nvmlSystemEventSetFree') + if __nvmlSystemEventSetFree == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemEventSetFree = dlsym(handle, 'nvmlSystemEventSetFree') + + global __nvmlSystemRegisterEvents + __nvmlSystemRegisterEvents = dlsym(RTLD_DEFAULT, 'nvmlSystemRegisterEvents') + if __nvmlSystemRegisterEvents == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemRegisterEvents = dlsym(handle, 'nvmlSystemRegisterEvents') + + global __nvmlSystemEventSetWait + __nvmlSystemEventSetWait = dlsym(RTLD_DEFAULT, 'nvmlSystemEventSetWait') + if __nvmlSystemEventSetWait == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemEventSetWait = dlsym(handle, 'nvmlSystemEventSetWait') + + global __nvmlDeviceModifyDrainState + __nvmlDeviceModifyDrainState = dlsym(RTLD_DEFAULT, 'nvmlDeviceModifyDrainState') + if __nvmlDeviceModifyDrainState == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceModifyDrainState = dlsym(handle, 'nvmlDeviceModifyDrainState') + + global __nvmlDeviceQueryDrainState + __nvmlDeviceQueryDrainState = dlsym(RTLD_DEFAULT, 'nvmlDeviceQueryDrainState') + if __nvmlDeviceQueryDrainState == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceQueryDrainState = dlsym(handle, 'nvmlDeviceQueryDrainState') + + global __nvmlDeviceRemoveGpu_v2 + __nvmlDeviceRemoveGpu_v2 = dlsym(RTLD_DEFAULT, 'nvmlDeviceRemoveGpu_v2') + if __nvmlDeviceRemoveGpu_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceRemoveGpu_v2 = dlsym(handle, 'nvmlDeviceRemoveGpu_v2') + + global __nvmlDeviceDiscoverGpus + __nvmlDeviceDiscoverGpus = dlsym(RTLD_DEFAULT, 'nvmlDeviceDiscoverGpus') + if __nvmlDeviceDiscoverGpus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceDiscoverGpus = dlsym(handle, 'nvmlDeviceDiscoverGpus') + + global __nvmlDeviceGetFieldValues + __nvmlDeviceGetFieldValues = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetFieldValues') + if __nvmlDeviceGetFieldValues == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetFieldValues = dlsym(handle, 'nvmlDeviceGetFieldValues') + + global __nvmlDeviceClearFieldValues + __nvmlDeviceClearFieldValues = dlsym(RTLD_DEFAULT, 'nvmlDeviceClearFieldValues') + if __nvmlDeviceClearFieldValues == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceClearFieldValues = dlsym(handle, 'nvmlDeviceClearFieldValues') + + global __nvmlDeviceGetVirtualizationMode + __nvmlDeviceGetVirtualizationMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetVirtualizationMode') + if __nvmlDeviceGetVirtualizationMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVirtualizationMode = dlsym(handle, 'nvmlDeviceGetVirtualizationMode') + + global __nvmlDeviceGetHostVgpuMode + __nvmlDeviceGetHostVgpuMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetHostVgpuMode') + if __nvmlDeviceGetHostVgpuMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetHostVgpuMode = dlsym(handle, 'nvmlDeviceGetHostVgpuMode') + + global __nvmlDeviceSetVirtualizationMode + __nvmlDeviceSetVirtualizationMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetVirtualizationMode') + if __nvmlDeviceSetVirtualizationMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetVirtualizationMode = dlsym(handle, 'nvmlDeviceSetVirtualizationMode') + + global __nvmlDeviceGetVgpuHeterogeneousMode + __nvmlDeviceGetVgpuHeterogeneousMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetVgpuHeterogeneousMode') + if __nvmlDeviceGetVgpuHeterogeneousMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuHeterogeneousMode = dlsym(handle, 'nvmlDeviceGetVgpuHeterogeneousMode') + + global __nvmlDeviceSetVgpuHeterogeneousMode + __nvmlDeviceSetVgpuHeterogeneousMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetVgpuHeterogeneousMode') + if __nvmlDeviceSetVgpuHeterogeneousMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetVgpuHeterogeneousMode = dlsym(handle, 'nvmlDeviceSetVgpuHeterogeneousMode') + + global __nvmlVgpuInstanceGetPlacementId + __nvmlVgpuInstanceGetPlacementId = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetPlacementId') + if __nvmlVgpuInstanceGetPlacementId == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetPlacementId = dlsym(handle, 'nvmlVgpuInstanceGetPlacementId') + + global __nvmlDeviceGetVgpuTypeSupportedPlacements + __nvmlDeviceGetVgpuTypeSupportedPlacements = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetVgpuTypeSupportedPlacements') + if __nvmlDeviceGetVgpuTypeSupportedPlacements == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuTypeSupportedPlacements = dlsym(handle, 'nvmlDeviceGetVgpuTypeSupportedPlacements') + + global __nvmlDeviceGetVgpuTypeCreatablePlacements + __nvmlDeviceGetVgpuTypeCreatablePlacements = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetVgpuTypeCreatablePlacements') + if __nvmlDeviceGetVgpuTypeCreatablePlacements == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuTypeCreatablePlacements = dlsym(handle, 'nvmlDeviceGetVgpuTypeCreatablePlacements') + + global __nvmlVgpuTypeGetGspHeapSize + __nvmlVgpuTypeGetGspHeapSize = dlsym(RTLD_DEFAULT, 'nvmlVgpuTypeGetGspHeapSize') + if __nvmlVgpuTypeGetGspHeapSize == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetGspHeapSize = dlsym(handle, 'nvmlVgpuTypeGetGspHeapSize') + + global __nvmlVgpuTypeGetFbReservation + __nvmlVgpuTypeGetFbReservation = dlsym(RTLD_DEFAULT, 'nvmlVgpuTypeGetFbReservation') + if __nvmlVgpuTypeGetFbReservation == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetFbReservation = dlsym(handle, 'nvmlVgpuTypeGetFbReservation') + + global __nvmlVgpuInstanceGetRuntimeStateSize + __nvmlVgpuInstanceGetRuntimeStateSize = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetRuntimeStateSize') + if __nvmlVgpuInstanceGetRuntimeStateSize == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetRuntimeStateSize = dlsym(handle, 'nvmlVgpuInstanceGetRuntimeStateSize') + + global __nvmlDeviceSetVgpuCapabilities + __nvmlDeviceSetVgpuCapabilities = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetVgpuCapabilities') + if __nvmlDeviceSetVgpuCapabilities == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetVgpuCapabilities = dlsym(handle, 'nvmlDeviceSetVgpuCapabilities') + + global __nvmlDeviceGetGridLicensableFeatures_v4 + __nvmlDeviceGetGridLicensableFeatures_v4 = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetGridLicensableFeatures_v4') + if __nvmlDeviceGetGridLicensableFeatures_v4 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGridLicensableFeatures_v4 = dlsym(handle, 'nvmlDeviceGetGridLicensableFeatures_v4') + + global __nvmlGetVgpuDriverCapabilities + __nvmlGetVgpuDriverCapabilities = dlsym(RTLD_DEFAULT, 'nvmlGetVgpuDriverCapabilities') + if __nvmlGetVgpuDriverCapabilities == NULL: + if handle == NULL: + handle = load_library() + __nvmlGetVgpuDriverCapabilities = dlsym(handle, 'nvmlGetVgpuDriverCapabilities') + + global __nvmlDeviceGetVgpuCapabilities + __nvmlDeviceGetVgpuCapabilities = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetVgpuCapabilities') + if __nvmlDeviceGetVgpuCapabilities == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuCapabilities = dlsym(handle, 'nvmlDeviceGetVgpuCapabilities') + + global __nvmlDeviceGetSupportedVgpus + __nvmlDeviceGetSupportedVgpus = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetSupportedVgpus') + if __nvmlDeviceGetSupportedVgpus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetSupportedVgpus = dlsym(handle, 'nvmlDeviceGetSupportedVgpus') + + global __nvmlDeviceGetCreatableVgpus + __nvmlDeviceGetCreatableVgpus = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetCreatableVgpus') + if __nvmlDeviceGetCreatableVgpus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCreatableVgpus = dlsym(handle, 'nvmlDeviceGetCreatableVgpus') + + global __nvmlVgpuTypeGetClass + __nvmlVgpuTypeGetClass = dlsym(RTLD_DEFAULT, 'nvmlVgpuTypeGetClass') + if __nvmlVgpuTypeGetClass == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetClass = dlsym(handle, 'nvmlVgpuTypeGetClass') + + global __nvmlVgpuTypeGetName + __nvmlVgpuTypeGetName = dlsym(RTLD_DEFAULT, 'nvmlVgpuTypeGetName') + if __nvmlVgpuTypeGetName == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetName = dlsym(handle, 'nvmlVgpuTypeGetName') + + global __nvmlVgpuTypeGetGpuInstanceProfileId + __nvmlVgpuTypeGetGpuInstanceProfileId = dlsym(RTLD_DEFAULT, 'nvmlVgpuTypeGetGpuInstanceProfileId') + if __nvmlVgpuTypeGetGpuInstanceProfileId == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetGpuInstanceProfileId = dlsym(handle, 'nvmlVgpuTypeGetGpuInstanceProfileId') + + global __nvmlVgpuTypeGetDeviceID + __nvmlVgpuTypeGetDeviceID = dlsym(RTLD_DEFAULT, 'nvmlVgpuTypeGetDeviceID') + if __nvmlVgpuTypeGetDeviceID == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetDeviceID = dlsym(handle, 'nvmlVgpuTypeGetDeviceID') + + global __nvmlVgpuTypeGetFramebufferSize + __nvmlVgpuTypeGetFramebufferSize = dlsym(RTLD_DEFAULT, 'nvmlVgpuTypeGetFramebufferSize') + if __nvmlVgpuTypeGetFramebufferSize == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetFramebufferSize = dlsym(handle, 'nvmlVgpuTypeGetFramebufferSize') + + global __nvmlVgpuTypeGetNumDisplayHeads + __nvmlVgpuTypeGetNumDisplayHeads = dlsym(RTLD_DEFAULT, 'nvmlVgpuTypeGetNumDisplayHeads') + if __nvmlVgpuTypeGetNumDisplayHeads == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetNumDisplayHeads = dlsym(handle, 'nvmlVgpuTypeGetNumDisplayHeads') + + global __nvmlVgpuTypeGetResolution + __nvmlVgpuTypeGetResolution = dlsym(RTLD_DEFAULT, 'nvmlVgpuTypeGetResolution') + if __nvmlVgpuTypeGetResolution == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetResolution = dlsym(handle, 'nvmlVgpuTypeGetResolution') + + global __nvmlVgpuTypeGetLicense + __nvmlVgpuTypeGetLicense = dlsym(RTLD_DEFAULT, 'nvmlVgpuTypeGetLicense') + if __nvmlVgpuTypeGetLicense == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetLicense = dlsym(handle, 'nvmlVgpuTypeGetLicense') + + global __nvmlVgpuTypeGetFrameRateLimit + __nvmlVgpuTypeGetFrameRateLimit = dlsym(RTLD_DEFAULT, 'nvmlVgpuTypeGetFrameRateLimit') + if __nvmlVgpuTypeGetFrameRateLimit == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetFrameRateLimit = dlsym(handle, 'nvmlVgpuTypeGetFrameRateLimit') + + global __nvmlVgpuTypeGetMaxInstances + __nvmlVgpuTypeGetMaxInstances = dlsym(RTLD_DEFAULT, 'nvmlVgpuTypeGetMaxInstances') + if __nvmlVgpuTypeGetMaxInstances == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetMaxInstances = dlsym(handle, 'nvmlVgpuTypeGetMaxInstances') + + global __nvmlVgpuTypeGetMaxInstancesPerVm + __nvmlVgpuTypeGetMaxInstancesPerVm = dlsym(RTLD_DEFAULT, 'nvmlVgpuTypeGetMaxInstancesPerVm') + if __nvmlVgpuTypeGetMaxInstancesPerVm == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetMaxInstancesPerVm = dlsym(handle, 'nvmlVgpuTypeGetMaxInstancesPerVm') + + global __nvmlVgpuTypeGetBAR1Info + __nvmlVgpuTypeGetBAR1Info = dlsym(RTLD_DEFAULT, 'nvmlVgpuTypeGetBAR1Info') + if __nvmlVgpuTypeGetBAR1Info == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetBAR1Info = dlsym(handle, 'nvmlVgpuTypeGetBAR1Info') + + global __nvmlDeviceGetActiveVgpus + __nvmlDeviceGetActiveVgpus = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetActiveVgpus') + if __nvmlDeviceGetActiveVgpus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetActiveVgpus = dlsym(handle, 'nvmlDeviceGetActiveVgpus') + + global __nvmlVgpuInstanceGetVmID + __nvmlVgpuInstanceGetVmID = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetVmID') + if __nvmlVgpuInstanceGetVmID == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetVmID = dlsym(handle, 'nvmlVgpuInstanceGetVmID') + + global __nvmlVgpuInstanceGetUUID + __nvmlVgpuInstanceGetUUID = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetUUID') + if __nvmlVgpuInstanceGetUUID == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetUUID = dlsym(handle, 'nvmlVgpuInstanceGetUUID') + + global __nvmlVgpuInstanceGetVmDriverVersion + __nvmlVgpuInstanceGetVmDriverVersion = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetVmDriverVersion') + if __nvmlVgpuInstanceGetVmDriverVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetVmDriverVersion = dlsym(handle, 'nvmlVgpuInstanceGetVmDriverVersion') + + global __nvmlVgpuInstanceGetFbUsage + __nvmlVgpuInstanceGetFbUsage = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetFbUsage') + if __nvmlVgpuInstanceGetFbUsage == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetFbUsage = dlsym(handle, 'nvmlVgpuInstanceGetFbUsage') + + global __nvmlVgpuInstanceGetLicenseStatus + __nvmlVgpuInstanceGetLicenseStatus = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetLicenseStatus') + if __nvmlVgpuInstanceGetLicenseStatus == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetLicenseStatus = dlsym(handle, 'nvmlVgpuInstanceGetLicenseStatus') + + global __nvmlVgpuInstanceGetType + __nvmlVgpuInstanceGetType = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetType') + if __nvmlVgpuInstanceGetType == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetType = dlsym(handle, 'nvmlVgpuInstanceGetType') + + global __nvmlVgpuInstanceGetFrameRateLimit + __nvmlVgpuInstanceGetFrameRateLimit = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetFrameRateLimit') + if __nvmlVgpuInstanceGetFrameRateLimit == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetFrameRateLimit = dlsym(handle, 'nvmlVgpuInstanceGetFrameRateLimit') + + global __nvmlVgpuInstanceGetEccMode + __nvmlVgpuInstanceGetEccMode = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetEccMode') + if __nvmlVgpuInstanceGetEccMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetEccMode = dlsym(handle, 'nvmlVgpuInstanceGetEccMode') + + global __nvmlVgpuInstanceGetEncoderCapacity + __nvmlVgpuInstanceGetEncoderCapacity = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetEncoderCapacity') + if __nvmlVgpuInstanceGetEncoderCapacity == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetEncoderCapacity = dlsym(handle, 'nvmlVgpuInstanceGetEncoderCapacity') + + global __nvmlVgpuInstanceSetEncoderCapacity + __nvmlVgpuInstanceSetEncoderCapacity = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceSetEncoderCapacity') + if __nvmlVgpuInstanceSetEncoderCapacity == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceSetEncoderCapacity = dlsym(handle, 'nvmlVgpuInstanceSetEncoderCapacity') + + global __nvmlVgpuInstanceGetEncoderStats + __nvmlVgpuInstanceGetEncoderStats = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetEncoderStats') + if __nvmlVgpuInstanceGetEncoderStats == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetEncoderStats = dlsym(handle, 'nvmlVgpuInstanceGetEncoderStats') + + global __nvmlVgpuInstanceGetEncoderSessions + __nvmlVgpuInstanceGetEncoderSessions = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetEncoderSessions') + if __nvmlVgpuInstanceGetEncoderSessions == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetEncoderSessions = dlsym(handle, 'nvmlVgpuInstanceGetEncoderSessions') + + global __nvmlVgpuInstanceGetFBCStats + __nvmlVgpuInstanceGetFBCStats = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetFBCStats') + if __nvmlVgpuInstanceGetFBCStats == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetFBCStats = dlsym(handle, 'nvmlVgpuInstanceGetFBCStats') + + global __nvmlVgpuInstanceGetFBCSessions + __nvmlVgpuInstanceGetFBCSessions = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetFBCSessions') + if __nvmlVgpuInstanceGetFBCSessions == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetFBCSessions = dlsym(handle, 'nvmlVgpuInstanceGetFBCSessions') + + global __nvmlVgpuInstanceGetGpuInstanceId + __nvmlVgpuInstanceGetGpuInstanceId = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetGpuInstanceId') + if __nvmlVgpuInstanceGetGpuInstanceId == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetGpuInstanceId = dlsym(handle, 'nvmlVgpuInstanceGetGpuInstanceId') + + global __nvmlVgpuInstanceGetGpuPciId + __nvmlVgpuInstanceGetGpuPciId = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetGpuPciId') + if __nvmlVgpuInstanceGetGpuPciId == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetGpuPciId = dlsym(handle, 'nvmlVgpuInstanceGetGpuPciId') + + global __nvmlVgpuTypeGetCapabilities + __nvmlVgpuTypeGetCapabilities = dlsym(RTLD_DEFAULT, 'nvmlVgpuTypeGetCapabilities') + if __nvmlVgpuTypeGetCapabilities == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetCapabilities = dlsym(handle, 'nvmlVgpuTypeGetCapabilities') + + global __nvmlVgpuInstanceGetMdevUUID + __nvmlVgpuInstanceGetMdevUUID = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetMdevUUID') + if __nvmlVgpuInstanceGetMdevUUID == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetMdevUUID = dlsym(handle, 'nvmlVgpuInstanceGetMdevUUID') + + global __nvmlGpuInstanceGetCreatableVgpus + __nvmlGpuInstanceGetCreatableVgpus = dlsym(RTLD_DEFAULT, 'nvmlGpuInstanceGetCreatableVgpus') + if __nvmlGpuInstanceGetCreatableVgpus == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetCreatableVgpus = dlsym(handle, 'nvmlGpuInstanceGetCreatableVgpus') + + global __nvmlVgpuTypeGetMaxInstancesPerGpuInstance + __nvmlVgpuTypeGetMaxInstancesPerGpuInstance = dlsym(RTLD_DEFAULT, 'nvmlVgpuTypeGetMaxInstancesPerGpuInstance') + if __nvmlVgpuTypeGetMaxInstancesPerGpuInstance == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetMaxInstancesPerGpuInstance = dlsym(handle, 'nvmlVgpuTypeGetMaxInstancesPerGpuInstance') + + global __nvmlGpuInstanceGetActiveVgpus + __nvmlGpuInstanceGetActiveVgpus = dlsym(RTLD_DEFAULT, 'nvmlGpuInstanceGetActiveVgpus') + if __nvmlGpuInstanceGetActiveVgpus == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetActiveVgpus = dlsym(handle, 'nvmlGpuInstanceGetActiveVgpus') + + global __nvmlGpuInstanceSetVgpuSchedulerState + __nvmlGpuInstanceSetVgpuSchedulerState = dlsym(RTLD_DEFAULT, 'nvmlGpuInstanceSetVgpuSchedulerState') + if __nvmlGpuInstanceSetVgpuSchedulerState == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceSetVgpuSchedulerState = dlsym(handle, 'nvmlGpuInstanceSetVgpuSchedulerState') + + global __nvmlGpuInstanceGetVgpuSchedulerState + __nvmlGpuInstanceGetVgpuSchedulerState = dlsym(RTLD_DEFAULT, 'nvmlGpuInstanceGetVgpuSchedulerState') + if __nvmlGpuInstanceGetVgpuSchedulerState == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetVgpuSchedulerState = dlsym(handle, 'nvmlGpuInstanceGetVgpuSchedulerState') + + global __nvmlGpuInstanceGetVgpuSchedulerLog + __nvmlGpuInstanceGetVgpuSchedulerLog = dlsym(RTLD_DEFAULT, 'nvmlGpuInstanceGetVgpuSchedulerLog') + if __nvmlGpuInstanceGetVgpuSchedulerLog == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetVgpuSchedulerLog = dlsym(handle, 'nvmlGpuInstanceGetVgpuSchedulerLog') + + global __nvmlGpuInstanceGetVgpuTypeCreatablePlacements + __nvmlGpuInstanceGetVgpuTypeCreatablePlacements = dlsym(RTLD_DEFAULT, 'nvmlGpuInstanceGetVgpuTypeCreatablePlacements') + if __nvmlGpuInstanceGetVgpuTypeCreatablePlacements == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetVgpuTypeCreatablePlacements = dlsym(handle, 'nvmlGpuInstanceGetVgpuTypeCreatablePlacements') + + global __nvmlGpuInstanceGetVgpuHeterogeneousMode + __nvmlGpuInstanceGetVgpuHeterogeneousMode = dlsym(RTLD_DEFAULT, 'nvmlGpuInstanceGetVgpuHeterogeneousMode') + if __nvmlGpuInstanceGetVgpuHeterogeneousMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetVgpuHeterogeneousMode = dlsym(handle, 'nvmlGpuInstanceGetVgpuHeterogeneousMode') + + global __nvmlGpuInstanceSetVgpuHeterogeneousMode + __nvmlGpuInstanceSetVgpuHeterogeneousMode = dlsym(RTLD_DEFAULT, 'nvmlGpuInstanceSetVgpuHeterogeneousMode') + if __nvmlGpuInstanceSetVgpuHeterogeneousMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceSetVgpuHeterogeneousMode = dlsym(handle, 'nvmlGpuInstanceSetVgpuHeterogeneousMode') + + global __nvmlVgpuInstanceGetMetadata + __nvmlVgpuInstanceGetMetadata = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetMetadata') + if __nvmlVgpuInstanceGetMetadata == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetMetadata = dlsym(handle, 'nvmlVgpuInstanceGetMetadata') + + global __nvmlDeviceGetVgpuMetadata + __nvmlDeviceGetVgpuMetadata = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetVgpuMetadata') + if __nvmlDeviceGetVgpuMetadata == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuMetadata = dlsym(handle, 'nvmlDeviceGetVgpuMetadata') + + global __nvmlGetVgpuCompatibility + __nvmlGetVgpuCompatibility = dlsym(RTLD_DEFAULT, 'nvmlGetVgpuCompatibility') + if __nvmlGetVgpuCompatibility == NULL: + if handle == NULL: + handle = load_library() + __nvmlGetVgpuCompatibility = dlsym(handle, 'nvmlGetVgpuCompatibility') + + global __nvmlDeviceGetPgpuMetadataString + __nvmlDeviceGetPgpuMetadataString = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetPgpuMetadataString') + if __nvmlDeviceGetPgpuMetadataString == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPgpuMetadataString = dlsym(handle, 'nvmlDeviceGetPgpuMetadataString') + + global __nvmlDeviceGetVgpuSchedulerLog + __nvmlDeviceGetVgpuSchedulerLog = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetVgpuSchedulerLog') + if __nvmlDeviceGetVgpuSchedulerLog == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuSchedulerLog = dlsym(handle, 'nvmlDeviceGetVgpuSchedulerLog') + + global __nvmlDeviceGetVgpuSchedulerState + __nvmlDeviceGetVgpuSchedulerState = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetVgpuSchedulerState') + if __nvmlDeviceGetVgpuSchedulerState == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuSchedulerState = dlsym(handle, 'nvmlDeviceGetVgpuSchedulerState') + + global __nvmlDeviceGetVgpuSchedulerCapabilities + __nvmlDeviceGetVgpuSchedulerCapabilities = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetVgpuSchedulerCapabilities') + if __nvmlDeviceGetVgpuSchedulerCapabilities == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuSchedulerCapabilities = dlsym(handle, 'nvmlDeviceGetVgpuSchedulerCapabilities') + + global __nvmlDeviceSetVgpuSchedulerState + __nvmlDeviceSetVgpuSchedulerState = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetVgpuSchedulerState') + if __nvmlDeviceSetVgpuSchedulerState == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetVgpuSchedulerState = dlsym(handle, 'nvmlDeviceSetVgpuSchedulerState') + + global __nvmlGetVgpuVersion + __nvmlGetVgpuVersion = dlsym(RTLD_DEFAULT, 'nvmlGetVgpuVersion') + if __nvmlGetVgpuVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlGetVgpuVersion = dlsym(handle, 'nvmlGetVgpuVersion') + + global __nvmlSetVgpuVersion + __nvmlSetVgpuVersion = dlsym(RTLD_DEFAULT, 'nvmlSetVgpuVersion') + if __nvmlSetVgpuVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlSetVgpuVersion = dlsym(handle, 'nvmlSetVgpuVersion') + + global __nvmlDeviceGetVgpuUtilization + __nvmlDeviceGetVgpuUtilization = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetVgpuUtilization') + if __nvmlDeviceGetVgpuUtilization == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuUtilization = dlsym(handle, 'nvmlDeviceGetVgpuUtilization') + + global __nvmlDeviceGetVgpuInstancesUtilizationInfo + __nvmlDeviceGetVgpuInstancesUtilizationInfo = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetVgpuInstancesUtilizationInfo') + if __nvmlDeviceGetVgpuInstancesUtilizationInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuInstancesUtilizationInfo = dlsym(handle, 'nvmlDeviceGetVgpuInstancesUtilizationInfo') + + global __nvmlDeviceGetVgpuProcessUtilization + __nvmlDeviceGetVgpuProcessUtilization = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetVgpuProcessUtilization') + if __nvmlDeviceGetVgpuProcessUtilization == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuProcessUtilization = dlsym(handle, 'nvmlDeviceGetVgpuProcessUtilization') + + global __nvmlDeviceGetVgpuProcessesUtilizationInfo + __nvmlDeviceGetVgpuProcessesUtilizationInfo = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetVgpuProcessesUtilizationInfo') + if __nvmlDeviceGetVgpuProcessesUtilizationInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuProcessesUtilizationInfo = dlsym(handle, 'nvmlDeviceGetVgpuProcessesUtilizationInfo') + + global __nvmlVgpuInstanceGetAccountingMode + __nvmlVgpuInstanceGetAccountingMode = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetAccountingMode') + if __nvmlVgpuInstanceGetAccountingMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetAccountingMode = dlsym(handle, 'nvmlVgpuInstanceGetAccountingMode') + + global __nvmlVgpuInstanceGetAccountingPids + __nvmlVgpuInstanceGetAccountingPids = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetAccountingPids') + if __nvmlVgpuInstanceGetAccountingPids == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetAccountingPids = dlsym(handle, 'nvmlVgpuInstanceGetAccountingPids') + + global __nvmlVgpuInstanceGetAccountingStats + __nvmlVgpuInstanceGetAccountingStats = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetAccountingStats') + if __nvmlVgpuInstanceGetAccountingStats == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetAccountingStats = dlsym(handle, 'nvmlVgpuInstanceGetAccountingStats') + + global __nvmlVgpuInstanceClearAccountingPids + __nvmlVgpuInstanceClearAccountingPids = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceClearAccountingPids') + if __nvmlVgpuInstanceClearAccountingPids == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceClearAccountingPids = dlsym(handle, 'nvmlVgpuInstanceClearAccountingPids') + + global __nvmlVgpuInstanceGetLicenseInfo_v2 + __nvmlVgpuInstanceGetLicenseInfo_v2 = dlsym(RTLD_DEFAULT, 'nvmlVgpuInstanceGetLicenseInfo_v2') + if __nvmlVgpuInstanceGetLicenseInfo_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetLicenseInfo_v2 = dlsym(handle, 'nvmlVgpuInstanceGetLicenseInfo_v2') + + global __nvmlGetExcludedDeviceCount + __nvmlGetExcludedDeviceCount = dlsym(RTLD_DEFAULT, 'nvmlGetExcludedDeviceCount') + if __nvmlGetExcludedDeviceCount == NULL: + if handle == NULL: + handle = load_library() + __nvmlGetExcludedDeviceCount = dlsym(handle, 'nvmlGetExcludedDeviceCount') + + global __nvmlGetExcludedDeviceInfoByIndex + __nvmlGetExcludedDeviceInfoByIndex = dlsym(RTLD_DEFAULT, 'nvmlGetExcludedDeviceInfoByIndex') + if __nvmlGetExcludedDeviceInfoByIndex == NULL: + if handle == NULL: + handle = load_library() + __nvmlGetExcludedDeviceInfoByIndex = dlsym(handle, 'nvmlGetExcludedDeviceInfoByIndex') + + global __nvmlDeviceSetMigMode + __nvmlDeviceSetMigMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetMigMode') + if __nvmlDeviceSetMigMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetMigMode = dlsym(handle, 'nvmlDeviceSetMigMode') + + global __nvmlDeviceGetMigMode + __nvmlDeviceGetMigMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetMigMode') + if __nvmlDeviceGetMigMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMigMode = dlsym(handle, 'nvmlDeviceGetMigMode') + + global __nvmlDeviceGetGpuInstanceProfileInfoV + __nvmlDeviceGetGpuInstanceProfileInfoV = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetGpuInstanceProfileInfoV') + if __nvmlDeviceGetGpuInstanceProfileInfoV == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpuInstanceProfileInfoV = dlsym(handle, 'nvmlDeviceGetGpuInstanceProfileInfoV') + + global __nvmlDeviceGetGpuInstancePossiblePlacements_v2 + __nvmlDeviceGetGpuInstancePossiblePlacements_v2 = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetGpuInstancePossiblePlacements_v2') + if __nvmlDeviceGetGpuInstancePossiblePlacements_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpuInstancePossiblePlacements_v2 = dlsym(handle, 'nvmlDeviceGetGpuInstancePossiblePlacements_v2') + + global __nvmlDeviceGetGpuInstanceRemainingCapacity + __nvmlDeviceGetGpuInstanceRemainingCapacity = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetGpuInstanceRemainingCapacity') + if __nvmlDeviceGetGpuInstanceRemainingCapacity == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpuInstanceRemainingCapacity = dlsym(handle, 'nvmlDeviceGetGpuInstanceRemainingCapacity') + + global __nvmlDeviceCreateGpuInstance + __nvmlDeviceCreateGpuInstance = dlsym(RTLD_DEFAULT, 'nvmlDeviceCreateGpuInstance') + if __nvmlDeviceCreateGpuInstance == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceCreateGpuInstance = dlsym(handle, 'nvmlDeviceCreateGpuInstance') + + global __nvmlDeviceCreateGpuInstanceWithPlacement + __nvmlDeviceCreateGpuInstanceWithPlacement = dlsym(RTLD_DEFAULT, 'nvmlDeviceCreateGpuInstanceWithPlacement') + if __nvmlDeviceCreateGpuInstanceWithPlacement == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceCreateGpuInstanceWithPlacement = dlsym(handle, 'nvmlDeviceCreateGpuInstanceWithPlacement') + + global __nvmlGpuInstanceDestroy + __nvmlGpuInstanceDestroy = dlsym(RTLD_DEFAULT, 'nvmlGpuInstanceDestroy') + if __nvmlGpuInstanceDestroy == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceDestroy = dlsym(handle, 'nvmlGpuInstanceDestroy') + + global __nvmlDeviceGetGpuInstances + __nvmlDeviceGetGpuInstances = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetGpuInstances') + if __nvmlDeviceGetGpuInstances == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpuInstances = dlsym(handle, 'nvmlDeviceGetGpuInstances') + + global __nvmlDeviceGetGpuInstanceById + __nvmlDeviceGetGpuInstanceById = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetGpuInstanceById') + if __nvmlDeviceGetGpuInstanceById == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpuInstanceById = dlsym(handle, 'nvmlDeviceGetGpuInstanceById') + + global __nvmlGpuInstanceGetInfo + __nvmlGpuInstanceGetInfo = dlsym(RTLD_DEFAULT, 'nvmlGpuInstanceGetInfo') + if __nvmlGpuInstanceGetInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetInfo = dlsym(handle, 'nvmlGpuInstanceGetInfo') + + global __nvmlGpuInstanceGetComputeInstanceProfileInfoV + __nvmlGpuInstanceGetComputeInstanceProfileInfoV = dlsym(RTLD_DEFAULT, 'nvmlGpuInstanceGetComputeInstanceProfileInfoV') + if __nvmlGpuInstanceGetComputeInstanceProfileInfoV == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetComputeInstanceProfileInfoV = dlsym(handle, 'nvmlGpuInstanceGetComputeInstanceProfileInfoV') + + global __nvmlGpuInstanceGetComputeInstanceRemainingCapacity + __nvmlGpuInstanceGetComputeInstanceRemainingCapacity = dlsym(RTLD_DEFAULT, 'nvmlGpuInstanceGetComputeInstanceRemainingCapacity') + if __nvmlGpuInstanceGetComputeInstanceRemainingCapacity == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetComputeInstanceRemainingCapacity = dlsym(handle, 'nvmlGpuInstanceGetComputeInstanceRemainingCapacity') + + global __nvmlGpuInstanceGetComputeInstancePossiblePlacements + __nvmlGpuInstanceGetComputeInstancePossiblePlacements = dlsym(RTLD_DEFAULT, 'nvmlGpuInstanceGetComputeInstancePossiblePlacements') + if __nvmlGpuInstanceGetComputeInstancePossiblePlacements == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetComputeInstancePossiblePlacements = dlsym(handle, 'nvmlGpuInstanceGetComputeInstancePossiblePlacements') + + global __nvmlGpuInstanceCreateComputeInstance + __nvmlGpuInstanceCreateComputeInstance = dlsym(RTLD_DEFAULT, 'nvmlGpuInstanceCreateComputeInstance') + if __nvmlGpuInstanceCreateComputeInstance == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceCreateComputeInstance = dlsym(handle, 'nvmlGpuInstanceCreateComputeInstance') + + global __nvmlGpuInstanceCreateComputeInstanceWithPlacement + __nvmlGpuInstanceCreateComputeInstanceWithPlacement = dlsym(RTLD_DEFAULT, 'nvmlGpuInstanceCreateComputeInstanceWithPlacement') + if __nvmlGpuInstanceCreateComputeInstanceWithPlacement == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceCreateComputeInstanceWithPlacement = dlsym(handle, 'nvmlGpuInstanceCreateComputeInstanceWithPlacement') + + global __nvmlComputeInstanceDestroy + __nvmlComputeInstanceDestroy = dlsym(RTLD_DEFAULT, 'nvmlComputeInstanceDestroy') + if __nvmlComputeInstanceDestroy == NULL: + if handle == NULL: + handle = load_library() + __nvmlComputeInstanceDestroy = dlsym(handle, 'nvmlComputeInstanceDestroy') + + global __nvmlGpuInstanceGetComputeInstances + __nvmlGpuInstanceGetComputeInstances = dlsym(RTLD_DEFAULT, 'nvmlGpuInstanceGetComputeInstances') + if __nvmlGpuInstanceGetComputeInstances == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetComputeInstances = dlsym(handle, 'nvmlGpuInstanceGetComputeInstances') + + global __nvmlGpuInstanceGetComputeInstanceById + __nvmlGpuInstanceGetComputeInstanceById = dlsym(RTLD_DEFAULT, 'nvmlGpuInstanceGetComputeInstanceById') + if __nvmlGpuInstanceGetComputeInstanceById == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetComputeInstanceById = dlsym(handle, 'nvmlGpuInstanceGetComputeInstanceById') + + global __nvmlComputeInstanceGetInfo_v2 + __nvmlComputeInstanceGetInfo_v2 = dlsym(RTLD_DEFAULT, 'nvmlComputeInstanceGetInfo_v2') + if __nvmlComputeInstanceGetInfo_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlComputeInstanceGetInfo_v2 = dlsym(handle, 'nvmlComputeInstanceGetInfo_v2') + + global __nvmlDeviceIsMigDeviceHandle + __nvmlDeviceIsMigDeviceHandle = dlsym(RTLD_DEFAULT, 'nvmlDeviceIsMigDeviceHandle') + if __nvmlDeviceIsMigDeviceHandle == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceIsMigDeviceHandle = dlsym(handle, 'nvmlDeviceIsMigDeviceHandle') + + global __nvmlDeviceGetGpuInstanceId + __nvmlDeviceGetGpuInstanceId = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetGpuInstanceId') + if __nvmlDeviceGetGpuInstanceId == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpuInstanceId = dlsym(handle, 'nvmlDeviceGetGpuInstanceId') + + global __nvmlDeviceGetComputeInstanceId + __nvmlDeviceGetComputeInstanceId = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetComputeInstanceId') + if __nvmlDeviceGetComputeInstanceId == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetComputeInstanceId = dlsym(handle, 'nvmlDeviceGetComputeInstanceId') + + global __nvmlDeviceGetMaxMigDeviceCount + __nvmlDeviceGetMaxMigDeviceCount = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetMaxMigDeviceCount') + if __nvmlDeviceGetMaxMigDeviceCount == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMaxMigDeviceCount = dlsym(handle, 'nvmlDeviceGetMaxMigDeviceCount') + + global __nvmlDeviceGetMigDeviceHandleByIndex + __nvmlDeviceGetMigDeviceHandleByIndex = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetMigDeviceHandleByIndex') + if __nvmlDeviceGetMigDeviceHandleByIndex == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMigDeviceHandleByIndex = dlsym(handle, 'nvmlDeviceGetMigDeviceHandleByIndex') + + global __nvmlDeviceGetDeviceHandleFromMigDeviceHandle + __nvmlDeviceGetDeviceHandleFromMigDeviceHandle = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetDeviceHandleFromMigDeviceHandle') + if __nvmlDeviceGetDeviceHandleFromMigDeviceHandle == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetDeviceHandleFromMigDeviceHandle = dlsym(handle, 'nvmlDeviceGetDeviceHandleFromMigDeviceHandle') + + global __nvmlGpmSampleGet + __nvmlGpmSampleGet = dlsym(RTLD_DEFAULT, 'nvmlGpmSampleGet') + if __nvmlGpmSampleGet == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpmSampleGet = dlsym(handle, 'nvmlGpmSampleGet') + + global __nvmlGpmMigSampleGet + __nvmlGpmMigSampleGet = dlsym(RTLD_DEFAULT, 'nvmlGpmMigSampleGet') + if __nvmlGpmMigSampleGet == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpmMigSampleGet = dlsym(handle, 'nvmlGpmMigSampleGet') + + global __nvmlGpmQueryDeviceSupport + __nvmlGpmQueryDeviceSupport = dlsym(RTLD_DEFAULT, 'nvmlGpmQueryDeviceSupport') + if __nvmlGpmQueryDeviceSupport == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpmQueryDeviceSupport = dlsym(handle, 'nvmlGpmQueryDeviceSupport') + + global __nvmlGpmQueryIfStreamingEnabled + __nvmlGpmQueryIfStreamingEnabled = dlsym(RTLD_DEFAULT, 'nvmlGpmQueryIfStreamingEnabled') + if __nvmlGpmQueryIfStreamingEnabled == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpmQueryIfStreamingEnabled = dlsym(handle, 'nvmlGpmQueryIfStreamingEnabled') + + global __nvmlGpmSetStreamingEnabled + __nvmlGpmSetStreamingEnabled = dlsym(RTLD_DEFAULT, 'nvmlGpmSetStreamingEnabled') + if __nvmlGpmSetStreamingEnabled == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpmSetStreamingEnabled = dlsym(handle, 'nvmlGpmSetStreamingEnabled') + + global __nvmlDeviceGetCapabilities + __nvmlDeviceGetCapabilities = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetCapabilities') + if __nvmlDeviceGetCapabilities == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCapabilities = dlsym(handle, 'nvmlDeviceGetCapabilities') + + global __nvmlDeviceWorkloadPowerProfileClearRequestedProfiles + __nvmlDeviceWorkloadPowerProfileClearRequestedProfiles = dlsym(RTLD_DEFAULT, 'nvmlDeviceWorkloadPowerProfileClearRequestedProfiles') + if __nvmlDeviceWorkloadPowerProfileClearRequestedProfiles == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceWorkloadPowerProfileClearRequestedProfiles = dlsym(handle, 'nvmlDeviceWorkloadPowerProfileClearRequestedProfiles') + + global __nvmlDevicePowerSmoothingActivatePresetProfile + __nvmlDevicePowerSmoothingActivatePresetProfile = dlsym(RTLD_DEFAULT, 'nvmlDevicePowerSmoothingActivatePresetProfile') + if __nvmlDevicePowerSmoothingActivatePresetProfile == NULL: + if handle == NULL: + handle = load_library() + __nvmlDevicePowerSmoothingActivatePresetProfile = dlsym(handle, 'nvmlDevicePowerSmoothingActivatePresetProfile') + + global __nvmlDevicePowerSmoothingUpdatePresetProfileParam + __nvmlDevicePowerSmoothingUpdatePresetProfileParam = dlsym(RTLD_DEFAULT, 'nvmlDevicePowerSmoothingUpdatePresetProfileParam') + if __nvmlDevicePowerSmoothingUpdatePresetProfileParam == NULL: + if handle == NULL: + handle = load_library() + __nvmlDevicePowerSmoothingUpdatePresetProfileParam = dlsym(handle, 'nvmlDevicePowerSmoothingUpdatePresetProfileParam') + + global __nvmlDevicePowerSmoothingSetState + __nvmlDevicePowerSmoothingSetState = dlsym(RTLD_DEFAULT, 'nvmlDevicePowerSmoothingSetState') + if __nvmlDevicePowerSmoothingSetState == NULL: + if handle == NULL: + handle = load_library() + __nvmlDevicePowerSmoothingSetState = dlsym(handle, 'nvmlDevicePowerSmoothingSetState') + + global __nvmlDeviceGetAddressingMode + __nvmlDeviceGetAddressingMode = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetAddressingMode') + if __nvmlDeviceGetAddressingMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetAddressingMode = dlsym(handle, 'nvmlDeviceGetAddressingMode') + + global __nvmlDeviceGetRepairStatus + __nvmlDeviceGetRepairStatus = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetRepairStatus') + if __nvmlDeviceGetRepairStatus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetRepairStatus = dlsym(handle, 'nvmlDeviceGetRepairStatus') + + global __nvmlDeviceGetPowerMizerMode_v1 + __nvmlDeviceGetPowerMizerMode_v1 = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetPowerMizerMode_v1') + if __nvmlDeviceGetPowerMizerMode_v1 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPowerMizerMode_v1 = dlsym(handle, 'nvmlDeviceGetPowerMizerMode_v1') + + global __nvmlDeviceSetPowerMizerMode_v1 + __nvmlDeviceSetPowerMizerMode_v1 = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetPowerMizerMode_v1') + if __nvmlDeviceSetPowerMizerMode_v1 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetPowerMizerMode_v1 = dlsym(handle, 'nvmlDeviceSetPowerMizerMode_v1') + + global __nvmlDeviceGetPdi + __nvmlDeviceGetPdi = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetPdi') + if __nvmlDeviceGetPdi == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPdi = dlsym(handle, 'nvmlDeviceGetPdi') + + global __nvmlDeviceSetHostname_v1 + __nvmlDeviceSetHostname_v1 = dlsym(RTLD_DEFAULT, 'nvmlDeviceSetHostname_v1') + if __nvmlDeviceSetHostname_v1 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetHostname_v1 = dlsym(handle, 'nvmlDeviceSetHostname_v1') + + global __nvmlDeviceGetHostname_v1 + __nvmlDeviceGetHostname_v1 = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetHostname_v1') + if __nvmlDeviceGetHostname_v1 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetHostname_v1 = dlsym(handle, 'nvmlDeviceGetHostname_v1') + + global __nvmlDeviceGetNvLinkInfo + __nvmlDeviceGetNvLinkInfo = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetNvLinkInfo') + if __nvmlDeviceGetNvLinkInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNvLinkInfo = dlsym(handle, 'nvmlDeviceGetNvLinkInfo') + + global __nvmlDeviceReadWritePRM_v1 + __nvmlDeviceReadWritePRM_v1 = dlsym(RTLD_DEFAULT, 'nvmlDeviceReadWritePRM_v1') + if __nvmlDeviceReadWritePRM_v1 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceReadWritePRM_v1 = dlsym(handle, 'nvmlDeviceReadWritePRM_v1') + + global __nvmlDeviceGetGpuInstanceProfileInfoByIdV + __nvmlDeviceGetGpuInstanceProfileInfoByIdV = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetGpuInstanceProfileInfoByIdV') + if __nvmlDeviceGetGpuInstanceProfileInfoByIdV == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpuInstanceProfileInfoByIdV = dlsym(handle, 'nvmlDeviceGetGpuInstanceProfileInfoByIdV') + + global __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts + __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts = dlsym(RTLD_DEFAULT, 'nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts') + if __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts = dlsym(handle, 'nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts') + + __py_nvml_init = True + return 0 + + +cdef inline int _check_or_init_nvml() except -1 nogil: + if __py_nvml_init: + return 0 + + return _init_nvml() + + +cdef dict func_ptrs = None + + +cpdef dict _inspect_function_pointers(): + global func_ptrs + if func_ptrs is not None: + return func_ptrs + + _check_or_init_nvml() + cdef dict data = {} + + global __nvmlInit_v2 + data["__nvmlInit_v2"] = __nvmlInit_v2 + + global __nvmlInitWithFlags + data["__nvmlInitWithFlags"] = __nvmlInitWithFlags + + global __nvmlShutdown + data["__nvmlShutdown"] = __nvmlShutdown + + global __nvmlErrorString + data["__nvmlErrorString"] = __nvmlErrorString + + global __nvmlSystemGetDriverVersion + data["__nvmlSystemGetDriverVersion"] = __nvmlSystemGetDriverVersion + + global __nvmlSystemGetNVMLVersion + data["__nvmlSystemGetNVMLVersion"] = __nvmlSystemGetNVMLVersion + + global __nvmlSystemGetCudaDriverVersion + data["__nvmlSystemGetCudaDriverVersion"] = __nvmlSystemGetCudaDriverVersion + + global __nvmlSystemGetCudaDriverVersion_v2 + data["__nvmlSystemGetCudaDriverVersion_v2"] = __nvmlSystemGetCudaDriverVersion_v2 + + global __nvmlSystemGetProcessName + data["__nvmlSystemGetProcessName"] = __nvmlSystemGetProcessName + + global __nvmlSystemGetHicVersion + data["__nvmlSystemGetHicVersion"] = __nvmlSystemGetHicVersion + + global __nvmlSystemGetTopologyGpuSet + data["__nvmlSystemGetTopologyGpuSet"] = __nvmlSystemGetTopologyGpuSet + + global __nvmlSystemGetDriverBranch + data["__nvmlSystemGetDriverBranch"] = __nvmlSystemGetDriverBranch + + global __nvmlUnitGetCount + data["__nvmlUnitGetCount"] = __nvmlUnitGetCount + + global __nvmlUnitGetHandleByIndex + data["__nvmlUnitGetHandleByIndex"] = __nvmlUnitGetHandleByIndex + + global __nvmlUnitGetUnitInfo + data["__nvmlUnitGetUnitInfo"] = __nvmlUnitGetUnitInfo + + global __nvmlUnitGetLedState + data["__nvmlUnitGetLedState"] = __nvmlUnitGetLedState + + global __nvmlUnitGetPsuInfo + data["__nvmlUnitGetPsuInfo"] = __nvmlUnitGetPsuInfo + + global __nvmlUnitGetTemperature + data["__nvmlUnitGetTemperature"] = __nvmlUnitGetTemperature + + global __nvmlUnitGetFanSpeedInfo + data["__nvmlUnitGetFanSpeedInfo"] = __nvmlUnitGetFanSpeedInfo + + global __nvmlUnitGetDevices + data["__nvmlUnitGetDevices"] = __nvmlUnitGetDevices + + global __nvmlDeviceGetCount_v2 + data["__nvmlDeviceGetCount_v2"] = __nvmlDeviceGetCount_v2 + + global __nvmlDeviceGetAttributes_v2 + data["__nvmlDeviceGetAttributes_v2"] = __nvmlDeviceGetAttributes_v2 + + global __nvmlDeviceGetHandleByIndex_v2 + data["__nvmlDeviceGetHandleByIndex_v2"] = __nvmlDeviceGetHandleByIndex_v2 + + global __nvmlDeviceGetHandleBySerial + data["__nvmlDeviceGetHandleBySerial"] = __nvmlDeviceGetHandleBySerial + + global __nvmlDeviceGetHandleByUUID + data["__nvmlDeviceGetHandleByUUID"] = __nvmlDeviceGetHandleByUUID + + global __nvmlDeviceGetHandleByUUIDV + data["__nvmlDeviceGetHandleByUUIDV"] = __nvmlDeviceGetHandleByUUIDV + + global __nvmlDeviceGetHandleByPciBusId_v2 + data["__nvmlDeviceGetHandleByPciBusId_v2"] = __nvmlDeviceGetHandleByPciBusId_v2 + + global __nvmlDeviceGetName + data["__nvmlDeviceGetName"] = __nvmlDeviceGetName + + global __nvmlDeviceGetBrand + data["__nvmlDeviceGetBrand"] = __nvmlDeviceGetBrand + + global __nvmlDeviceGetIndex + data["__nvmlDeviceGetIndex"] = __nvmlDeviceGetIndex + + global __nvmlDeviceGetSerial + data["__nvmlDeviceGetSerial"] = __nvmlDeviceGetSerial + + global __nvmlDeviceGetModuleId + data["__nvmlDeviceGetModuleId"] = __nvmlDeviceGetModuleId + + global __nvmlDeviceGetC2cModeInfoV + data["__nvmlDeviceGetC2cModeInfoV"] = __nvmlDeviceGetC2cModeInfoV + + global __nvmlDeviceGetMemoryAffinity + data["__nvmlDeviceGetMemoryAffinity"] = __nvmlDeviceGetMemoryAffinity + + global __nvmlDeviceGetCpuAffinityWithinScope + data["__nvmlDeviceGetCpuAffinityWithinScope"] = __nvmlDeviceGetCpuAffinityWithinScope + + global __nvmlDeviceGetCpuAffinity + data["__nvmlDeviceGetCpuAffinity"] = __nvmlDeviceGetCpuAffinity + + global __nvmlDeviceSetCpuAffinity + data["__nvmlDeviceSetCpuAffinity"] = __nvmlDeviceSetCpuAffinity + + global __nvmlDeviceClearCpuAffinity + data["__nvmlDeviceClearCpuAffinity"] = __nvmlDeviceClearCpuAffinity + + global __nvmlDeviceGetNumaNodeId + data["__nvmlDeviceGetNumaNodeId"] = __nvmlDeviceGetNumaNodeId + + global __nvmlDeviceGetTopologyCommonAncestor + data["__nvmlDeviceGetTopologyCommonAncestor"] = __nvmlDeviceGetTopologyCommonAncestor + + global __nvmlDeviceGetTopologyNearestGpus + data["__nvmlDeviceGetTopologyNearestGpus"] = __nvmlDeviceGetTopologyNearestGpus + + global __nvmlDeviceGetP2PStatus + data["__nvmlDeviceGetP2PStatus"] = __nvmlDeviceGetP2PStatus + + global __nvmlDeviceGetUUID + data["__nvmlDeviceGetUUID"] = __nvmlDeviceGetUUID + + global __nvmlDeviceGetMinorNumber + data["__nvmlDeviceGetMinorNumber"] = __nvmlDeviceGetMinorNumber + + global __nvmlDeviceGetBoardPartNumber + data["__nvmlDeviceGetBoardPartNumber"] = __nvmlDeviceGetBoardPartNumber + + global __nvmlDeviceGetInforomVersion + data["__nvmlDeviceGetInforomVersion"] = __nvmlDeviceGetInforomVersion + + global __nvmlDeviceGetInforomImageVersion + data["__nvmlDeviceGetInforomImageVersion"] = __nvmlDeviceGetInforomImageVersion + + global __nvmlDeviceGetInforomConfigurationChecksum + data["__nvmlDeviceGetInforomConfigurationChecksum"] = __nvmlDeviceGetInforomConfigurationChecksum + + global __nvmlDeviceValidateInforom + data["__nvmlDeviceValidateInforom"] = __nvmlDeviceValidateInforom + + global __nvmlDeviceGetLastBBXFlushTime + data["__nvmlDeviceGetLastBBXFlushTime"] = __nvmlDeviceGetLastBBXFlushTime + + global __nvmlDeviceGetDisplayMode + data["__nvmlDeviceGetDisplayMode"] = __nvmlDeviceGetDisplayMode + + global __nvmlDeviceGetDisplayActive + data["__nvmlDeviceGetDisplayActive"] = __nvmlDeviceGetDisplayActive + + global __nvmlDeviceGetPersistenceMode + data["__nvmlDeviceGetPersistenceMode"] = __nvmlDeviceGetPersistenceMode + + global __nvmlDeviceGetPciInfoExt + data["__nvmlDeviceGetPciInfoExt"] = __nvmlDeviceGetPciInfoExt + + global __nvmlDeviceGetPciInfo_v3 + data["__nvmlDeviceGetPciInfo_v3"] = __nvmlDeviceGetPciInfo_v3 + + global __nvmlDeviceGetMaxPcieLinkGeneration + data["__nvmlDeviceGetMaxPcieLinkGeneration"] = __nvmlDeviceGetMaxPcieLinkGeneration + + global __nvmlDeviceGetGpuMaxPcieLinkGeneration + data["__nvmlDeviceGetGpuMaxPcieLinkGeneration"] = __nvmlDeviceGetGpuMaxPcieLinkGeneration + + global __nvmlDeviceGetMaxPcieLinkWidth + data["__nvmlDeviceGetMaxPcieLinkWidth"] = __nvmlDeviceGetMaxPcieLinkWidth + + global __nvmlDeviceGetCurrPcieLinkGeneration + data["__nvmlDeviceGetCurrPcieLinkGeneration"] = __nvmlDeviceGetCurrPcieLinkGeneration + + global __nvmlDeviceGetCurrPcieLinkWidth + data["__nvmlDeviceGetCurrPcieLinkWidth"] = __nvmlDeviceGetCurrPcieLinkWidth + + global __nvmlDeviceGetPcieThroughput + data["__nvmlDeviceGetPcieThroughput"] = __nvmlDeviceGetPcieThroughput + + global __nvmlDeviceGetPcieReplayCounter + data["__nvmlDeviceGetPcieReplayCounter"] = __nvmlDeviceGetPcieReplayCounter + + global __nvmlDeviceGetClockInfo + data["__nvmlDeviceGetClockInfo"] = __nvmlDeviceGetClockInfo + + global __nvmlDeviceGetMaxClockInfo + data["__nvmlDeviceGetMaxClockInfo"] = __nvmlDeviceGetMaxClockInfo + + global __nvmlDeviceGetGpcClkVfOffset + data["__nvmlDeviceGetGpcClkVfOffset"] = __nvmlDeviceGetGpcClkVfOffset + + global __nvmlDeviceGetClock + data["__nvmlDeviceGetClock"] = __nvmlDeviceGetClock + + global __nvmlDeviceGetMaxCustomerBoostClock + data["__nvmlDeviceGetMaxCustomerBoostClock"] = __nvmlDeviceGetMaxCustomerBoostClock + + global __nvmlDeviceGetSupportedMemoryClocks + data["__nvmlDeviceGetSupportedMemoryClocks"] = __nvmlDeviceGetSupportedMemoryClocks + + global __nvmlDeviceGetSupportedGraphicsClocks + data["__nvmlDeviceGetSupportedGraphicsClocks"] = __nvmlDeviceGetSupportedGraphicsClocks + + global __nvmlDeviceGetAutoBoostedClocksEnabled + data["__nvmlDeviceGetAutoBoostedClocksEnabled"] = __nvmlDeviceGetAutoBoostedClocksEnabled + + global __nvmlDeviceGetFanSpeed + data["__nvmlDeviceGetFanSpeed"] = __nvmlDeviceGetFanSpeed + + global __nvmlDeviceGetFanSpeed_v2 + data["__nvmlDeviceGetFanSpeed_v2"] = __nvmlDeviceGetFanSpeed_v2 + + global __nvmlDeviceGetFanSpeedRPM + data["__nvmlDeviceGetFanSpeedRPM"] = __nvmlDeviceGetFanSpeedRPM + + global __nvmlDeviceGetTargetFanSpeed + data["__nvmlDeviceGetTargetFanSpeed"] = __nvmlDeviceGetTargetFanSpeed + + global __nvmlDeviceGetMinMaxFanSpeed + data["__nvmlDeviceGetMinMaxFanSpeed"] = __nvmlDeviceGetMinMaxFanSpeed + + global __nvmlDeviceGetFanControlPolicy_v2 + data["__nvmlDeviceGetFanControlPolicy_v2"] = __nvmlDeviceGetFanControlPolicy_v2 + + global __nvmlDeviceGetNumFans + data["__nvmlDeviceGetNumFans"] = __nvmlDeviceGetNumFans + + global __nvmlDeviceGetCoolerInfo + data["__nvmlDeviceGetCoolerInfo"] = __nvmlDeviceGetCoolerInfo + + global __nvmlDeviceGetTemperatureV + data["__nvmlDeviceGetTemperatureV"] = __nvmlDeviceGetTemperatureV + + global __nvmlDeviceGetTemperatureThreshold + data["__nvmlDeviceGetTemperatureThreshold"] = __nvmlDeviceGetTemperatureThreshold + + global __nvmlDeviceGetMarginTemperature + data["__nvmlDeviceGetMarginTemperature"] = __nvmlDeviceGetMarginTemperature + + global __nvmlDeviceGetThermalSettings + data["__nvmlDeviceGetThermalSettings"] = __nvmlDeviceGetThermalSettings + + global __nvmlDeviceGetPerformanceState + data["__nvmlDeviceGetPerformanceState"] = __nvmlDeviceGetPerformanceState + + global __nvmlDeviceGetCurrentClocksEventReasons + data["__nvmlDeviceGetCurrentClocksEventReasons"] = __nvmlDeviceGetCurrentClocksEventReasons + + global __nvmlDeviceGetSupportedClocksEventReasons + data["__nvmlDeviceGetSupportedClocksEventReasons"] = __nvmlDeviceGetSupportedClocksEventReasons + + global __nvmlDeviceGetPowerState + data["__nvmlDeviceGetPowerState"] = __nvmlDeviceGetPowerState + + global __nvmlDeviceGetDynamicPstatesInfo + data["__nvmlDeviceGetDynamicPstatesInfo"] = __nvmlDeviceGetDynamicPstatesInfo + + global __nvmlDeviceGetMemClkVfOffset + data["__nvmlDeviceGetMemClkVfOffset"] = __nvmlDeviceGetMemClkVfOffset + + global __nvmlDeviceGetMinMaxClockOfPState + data["__nvmlDeviceGetMinMaxClockOfPState"] = __nvmlDeviceGetMinMaxClockOfPState + + global __nvmlDeviceGetSupportedPerformanceStates + data["__nvmlDeviceGetSupportedPerformanceStates"] = __nvmlDeviceGetSupportedPerformanceStates + + global __nvmlDeviceGetGpcClkMinMaxVfOffset + data["__nvmlDeviceGetGpcClkMinMaxVfOffset"] = __nvmlDeviceGetGpcClkMinMaxVfOffset + + global __nvmlDeviceGetMemClkMinMaxVfOffset + data["__nvmlDeviceGetMemClkMinMaxVfOffset"] = __nvmlDeviceGetMemClkMinMaxVfOffset + + global __nvmlDeviceGetClockOffsets + data["__nvmlDeviceGetClockOffsets"] = __nvmlDeviceGetClockOffsets + + global __nvmlDeviceSetClockOffsets + data["__nvmlDeviceSetClockOffsets"] = __nvmlDeviceSetClockOffsets + + global __nvmlDeviceGetPerformanceModes + data["__nvmlDeviceGetPerformanceModes"] = __nvmlDeviceGetPerformanceModes + + global __nvmlDeviceGetCurrentClockFreqs + data["__nvmlDeviceGetCurrentClockFreqs"] = __nvmlDeviceGetCurrentClockFreqs + + global __nvmlDeviceGetPowerManagementLimit + data["__nvmlDeviceGetPowerManagementLimit"] = __nvmlDeviceGetPowerManagementLimit + + global __nvmlDeviceGetPowerManagementLimitConstraints + data["__nvmlDeviceGetPowerManagementLimitConstraints"] = __nvmlDeviceGetPowerManagementLimitConstraints + + global __nvmlDeviceGetPowerManagementDefaultLimit + data["__nvmlDeviceGetPowerManagementDefaultLimit"] = __nvmlDeviceGetPowerManagementDefaultLimit + + global __nvmlDeviceGetPowerUsage + data["__nvmlDeviceGetPowerUsage"] = __nvmlDeviceGetPowerUsage + + global __nvmlDeviceGetTotalEnergyConsumption + data["__nvmlDeviceGetTotalEnergyConsumption"] = __nvmlDeviceGetTotalEnergyConsumption + + global __nvmlDeviceGetEnforcedPowerLimit + data["__nvmlDeviceGetEnforcedPowerLimit"] = __nvmlDeviceGetEnforcedPowerLimit + + global __nvmlDeviceGetGpuOperationMode + data["__nvmlDeviceGetGpuOperationMode"] = __nvmlDeviceGetGpuOperationMode + + global __nvmlDeviceGetMemoryInfo_v2 + data["__nvmlDeviceGetMemoryInfo_v2"] = __nvmlDeviceGetMemoryInfo_v2 + + global __nvmlDeviceGetComputeMode + data["__nvmlDeviceGetComputeMode"] = __nvmlDeviceGetComputeMode + + global __nvmlDeviceGetCudaComputeCapability + data["__nvmlDeviceGetCudaComputeCapability"] = __nvmlDeviceGetCudaComputeCapability + + global __nvmlDeviceGetDramEncryptionMode + data["__nvmlDeviceGetDramEncryptionMode"] = __nvmlDeviceGetDramEncryptionMode + + global __nvmlDeviceSetDramEncryptionMode + data["__nvmlDeviceSetDramEncryptionMode"] = __nvmlDeviceSetDramEncryptionMode + + global __nvmlDeviceGetEccMode + data["__nvmlDeviceGetEccMode"] = __nvmlDeviceGetEccMode + + global __nvmlDeviceGetDefaultEccMode + data["__nvmlDeviceGetDefaultEccMode"] = __nvmlDeviceGetDefaultEccMode + + global __nvmlDeviceGetBoardId + data["__nvmlDeviceGetBoardId"] = __nvmlDeviceGetBoardId + + global __nvmlDeviceGetMultiGpuBoard + data["__nvmlDeviceGetMultiGpuBoard"] = __nvmlDeviceGetMultiGpuBoard + + global __nvmlDeviceGetTotalEccErrors + data["__nvmlDeviceGetTotalEccErrors"] = __nvmlDeviceGetTotalEccErrors + + global __nvmlDeviceGetMemoryErrorCounter + data["__nvmlDeviceGetMemoryErrorCounter"] = __nvmlDeviceGetMemoryErrorCounter + + global __nvmlDeviceGetUtilizationRates + data["__nvmlDeviceGetUtilizationRates"] = __nvmlDeviceGetUtilizationRates + + global __nvmlDeviceGetEncoderUtilization + data["__nvmlDeviceGetEncoderUtilization"] = __nvmlDeviceGetEncoderUtilization + + global __nvmlDeviceGetEncoderCapacity + data["__nvmlDeviceGetEncoderCapacity"] = __nvmlDeviceGetEncoderCapacity + + global __nvmlDeviceGetEncoderStats + data["__nvmlDeviceGetEncoderStats"] = __nvmlDeviceGetEncoderStats + + global __nvmlDeviceGetEncoderSessions + data["__nvmlDeviceGetEncoderSessions"] = __nvmlDeviceGetEncoderSessions + + global __nvmlDeviceGetDecoderUtilization + data["__nvmlDeviceGetDecoderUtilization"] = __nvmlDeviceGetDecoderUtilization + + global __nvmlDeviceGetJpgUtilization + data["__nvmlDeviceGetJpgUtilization"] = __nvmlDeviceGetJpgUtilization + + global __nvmlDeviceGetOfaUtilization + data["__nvmlDeviceGetOfaUtilization"] = __nvmlDeviceGetOfaUtilization + + global __nvmlDeviceGetFBCStats + data["__nvmlDeviceGetFBCStats"] = __nvmlDeviceGetFBCStats + + global __nvmlDeviceGetFBCSessions + data["__nvmlDeviceGetFBCSessions"] = __nvmlDeviceGetFBCSessions + + global __nvmlDeviceGetDriverModel_v2 + data["__nvmlDeviceGetDriverModel_v2"] = __nvmlDeviceGetDriverModel_v2 + + global __nvmlDeviceGetVbiosVersion + data["__nvmlDeviceGetVbiosVersion"] = __nvmlDeviceGetVbiosVersion + + global __nvmlDeviceGetBridgeChipInfo + data["__nvmlDeviceGetBridgeChipInfo"] = __nvmlDeviceGetBridgeChipInfo + + global __nvmlDeviceGetComputeRunningProcesses_v3 + data["__nvmlDeviceGetComputeRunningProcesses_v3"] = __nvmlDeviceGetComputeRunningProcesses_v3 + + global __nvmlDeviceGetGraphicsRunningProcesses_v3 + data["__nvmlDeviceGetGraphicsRunningProcesses_v3"] = __nvmlDeviceGetGraphicsRunningProcesses_v3 + + global __nvmlDeviceGetMPSComputeRunningProcesses_v3 + data["__nvmlDeviceGetMPSComputeRunningProcesses_v3"] = __nvmlDeviceGetMPSComputeRunningProcesses_v3 + + global __nvmlDeviceGetRunningProcessDetailList + data["__nvmlDeviceGetRunningProcessDetailList"] = __nvmlDeviceGetRunningProcessDetailList + + global __nvmlDeviceOnSameBoard + data["__nvmlDeviceOnSameBoard"] = __nvmlDeviceOnSameBoard + + global __nvmlDeviceGetAPIRestriction + data["__nvmlDeviceGetAPIRestriction"] = __nvmlDeviceGetAPIRestriction + + global __nvmlDeviceGetSamples + data["__nvmlDeviceGetSamples"] = __nvmlDeviceGetSamples + + global __nvmlDeviceGetBAR1MemoryInfo + data["__nvmlDeviceGetBAR1MemoryInfo"] = __nvmlDeviceGetBAR1MemoryInfo + + global __nvmlDeviceGetIrqNum + data["__nvmlDeviceGetIrqNum"] = __nvmlDeviceGetIrqNum + + global __nvmlDeviceGetNumGpuCores + data["__nvmlDeviceGetNumGpuCores"] = __nvmlDeviceGetNumGpuCores + + global __nvmlDeviceGetPowerSource + data["__nvmlDeviceGetPowerSource"] = __nvmlDeviceGetPowerSource + + global __nvmlDeviceGetMemoryBusWidth + data["__nvmlDeviceGetMemoryBusWidth"] = __nvmlDeviceGetMemoryBusWidth + + global __nvmlDeviceGetPcieLinkMaxSpeed + data["__nvmlDeviceGetPcieLinkMaxSpeed"] = __nvmlDeviceGetPcieLinkMaxSpeed + + global __nvmlDeviceGetPcieSpeed + data["__nvmlDeviceGetPcieSpeed"] = __nvmlDeviceGetPcieSpeed + + global __nvmlDeviceGetAdaptiveClockInfoStatus + data["__nvmlDeviceGetAdaptiveClockInfoStatus"] = __nvmlDeviceGetAdaptiveClockInfoStatus + + global __nvmlDeviceGetBusType + data["__nvmlDeviceGetBusType"] = __nvmlDeviceGetBusType + + global __nvmlDeviceGetGpuFabricInfoV + data["__nvmlDeviceGetGpuFabricInfoV"] = __nvmlDeviceGetGpuFabricInfoV + + global __nvmlSystemGetConfComputeCapabilities + data["__nvmlSystemGetConfComputeCapabilities"] = __nvmlSystemGetConfComputeCapabilities + + global __nvmlSystemGetConfComputeState + data["__nvmlSystemGetConfComputeState"] = __nvmlSystemGetConfComputeState + + global __nvmlDeviceGetConfComputeMemSizeInfo + data["__nvmlDeviceGetConfComputeMemSizeInfo"] = __nvmlDeviceGetConfComputeMemSizeInfo + + global __nvmlSystemGetConfComputeGpusReadyState + data["__nvmlSystemGetConfComputeGpusReadyState"] = __nvmlSystemGetConfComputeGpusReadyState + + global __nvmlDeviceGetConfComputeProtectedMemoryUsage + data["__nvmlDeviceGetConfComputeProtectedMemoryUsage"] = __nvmlDeviceGetConfComputeProtectedMemoryUsage + + global __nvmlDeviceGetConfComputeGpuCertificate + data["__nvmlDeviceGetConfComputeGpuCertificate"] = __nvmlDeviceGetConfComputeGpuCertificate + + global __nvmlDeviceGetConfComputeGpuAttestationReport + data["__nvmlDeviceGetConfComputeGpuAttestationReport"] = __nvmlDeviceGetConfComputeGpuAttestationReport + + global __nvmlSystemGetConfComputeKeyRotationThresholdInfo + data["__nvmlSystemGetConfComputeKeyRotationThresholdInfo"] = __nvmlSystemGetConfComputeKeyRotationThresholdInfo + + global __nvmlDeviceSetConfComputeUnprotectedMemSize + data["__nvmlDeviceSetConfComputeUnprotectedMemSize"] = __nvmlDeviceSetConfComputeUnprotectedMemSize + + global __nvmlSystemSetConfComputeGpusReadyState + data["__nvmlSystemSetConfComputeGpusReadyState"] = __nvmlSystemSetConfComputeGpusReadyState + + global __nvmlSystemSetConfComputeKeyRotationThresholdInfo + data["__nvmlSystemSetConfComputeKeyRotationThresholdInfo"] = __nvmlSystemSetConfComputeKeyRotationThresholdInfo + + global __nvmlSystemGetConfComputeSettings + data["__nvmlSystemGetConfComputeSettings"] = __nvmlSystemGetConfComputeSettings + + global __nvmlDeviceGetGspFirmwareVersion + data["__nvmlDeviceGetGspFirmwareVersion"] = __nvmlDeviceGetGspFirmwareVersion + + global __nvmlDeviceGetGspFirmwareMode + data["__nvmlDeviceGetGspFirmwareMode"] = __nvmlDeviceGetGspFirmwareMode + + global __nvmlDeviceGetSramEccErrorStatus + data["__nvmlDeviceGetSramEccErrorStatus"] = __nvmlDeviceGetSramEccErrorStatus + + global __nvmlDeviceGetAccountingMode + data["__nvmlDeviceGetAccountingMode"] = __nvmlDeviceGetAccountingMode + + global __nvmlDeviceGetAccountingStats + data["__nvmlDeviceGetAccountingStats"] = __nvmlDeviceGetAccountingStats + + global __nvmlDeviceGetAccountingPids + data["__nvmlDeviceGetAccountingPids"] = __nvmlDeviceGetAccountingPids + + global __nvmlDeviceGetAccountingBufferSize + data["__nvmlDeviceGetAccountingBufferSize"] = __nvmlDeviceGetAccountingBufferSize + + global __nvmlDeviceGetRetiredPages + data["__nvmlDeviceGetRetiredPages"] = __nvmlDeviceGetRetiredPages + + global __nvmlDeviceGetRetiredPages_v2 + data["__nvmlDeviceGetRetiredPages_v2"] = __nvmlDeviceGetRetiredPages_v2 + + global __nvmlDeviceGetRetiredPagesPendingStatus + data["__nvmlDeviceGetRetiredPagesPendingStatus"] = __nvmlDeviceGetRetiredPagesPendingStatus + + global __nvmlDeviceGetRemappedRows + data["__nvmlDeviceGetRemappedRows"] = __nvmlDeviceGetRemappedRows + + global __nvmlDeviceGetRowRemapperHistogram + data["__nvmlDeviceGetRowRemapperHistogram"] = __nvmlDeviceGetRowRemapperHistogram + + global __nvmlDeviceGetArchitecture + data["__nvmlDeviceGetArchitecture"] = __nvmlDeviceGetArchitecture + + global __nvmlDeviceGetClkMonStatus + data["__nvmlDeviceGetClkMonStatus"] = __nvmlDeviceGetClkMonStatus + + global __nvmlDeviceGetProcessUtilization + data["__nvmlDeviceGetProcessUtilization"] = __nvmlDeviceGetProcessUtilization + + global __nvmlDeviceGetProcessesUtilizationInfo + data["__nvmlDeviceGetProcessesUtilizationInfo"] = __nvmlDeviceGetProcessesUtilizationInfo + + global __nvmlDeviceGetPlatformInfo + data["__nvmlDeviceGetPlatformInfo"] = __nvmlDeviceGetPlatformInfo + + global __nvmlUnitSetLedState + data["__nvmlUnitSetLedState"] = __nvmlUnitSetLedState + + global __nvmlDeviceSetPersistenceMode + data["__nvmlDeviceSetPersistenceMode"] = __nvmlDeviceSetPersistenceMode + + global __nvmlDeviceSetComputeMode + data["__nvmlDeviceSetComputeMode"] = __nvmlDeviceSetComputeMode + + global __nvmlDeviceSetEccMode + data["__nvmlDeviceSetEccMode"] = __nvmlDeviceSetEccMode + + global __nvmlDeviceClearEccErrorCounts + data["__nvmlDeviceClearEccErrorCounts"] = __nvmlDeviceClearEccErrorCounts + + global __nvmlDeviceSetDriverModel + data["__nvmlDeviceSetDriverModel"] = __nvmlDeviceSetDriverModel + + global __nvmlDeviceSetGpuLockedClocks + data["__nvmlDeviceSetGpuLockedClocks"] = __nvmlDeviceSetGpuLockedClocks + + global __nvmlDeviceResetGpuLockedClocks + data["__nvmlDeviceResetGpuLockedClocks"] = __nvmlDeviceResetGpuLockedClocks + + global __nvmlDeviceSetMemoryLockedClocks + data["__nvmlDeviceSetMemoryLockedClocks"] = __nvmlDeviceSetMemoryLockedClocks + + global __nvmlDeviceResetMemoryLockedClocks + data["__nvmlDeviceResetMemoryLockedClocks"] = __nvmlDeviceResetMemoryLockedClocks + + global __nvmlDeviceSetAutoBoostedClocksEnabled + data["__nvmlDeviceSetAutoBoostedClocksEnabled"] = __nvmlDeviceSetAutoBoostedClocksEnabled + + global __nvmlDeviceSetDefaultAutoBoostedClocksEnabled + data["__nvmlDeviceSetDefaultAutoBoostedClocksEnabled"] = __nvmlDeviceSetDefaultAutoBoostedClocksEnabled + + global __nvmlDeviceSetDefaultFanSpeed_v2 + data["__nvmlDeviceSetDefaultFanSpeed_v2"] = __nvmlDeviceSetDefaultFanSpeed_v2 + + global __nvmlDeviceSetFanControlPolicy + data["__nvmlDeviceSetFanControlPolicy"] = __nvmlDeviceSetFanControlPolicy + + global __nvmlDeviceSetTemperatureThreshold + data["__nvmlDeviceSetTemperatureThreshold"] = __nvmlDeviceSetTemperatureThreshold + + global __nvmlDeviceSetPowerManagementLimit + data["__nvmlDeviceSetPowerManagementLimit"] = __nvmlDeviceSetPowerManagementLimit + + global __nvmlDeviceSetGpuOperationMode + data["__nvmlDeviceSetGpuOperationMode"] = __nvmlDeviceSetGpuOperationMode + + global __nvmlDeviceSetAPIRestriction + data["__nvmlDeviceSetAPIRestriction"] = __nvmlDeviceSetAPIRestriction + + global __nvmlDeviceSetFanSpeed_v2 + data["__nvmlDeviceSetFanSpeed_v2"] = __nvmlDeviceSetFanSpeed_v2 + + global __nvmlDeviceSetAccountingMode + data["__nvmlDeviceSetAccountingMode"] = __nvmlDeviceSetAccountingMode + + global __nvmlDeviceClearAccountingPids + data["__nvmlDeviceClearAccountingPids"] = __nvmlDeviceClearAccountingPids + + global __nvmlDeviceSetPowerManagementLimit_v2 + data["__nvmlDeviceSetPowerManagementLimit_v2"] = __nvmlDeviceSetPowerManagementLimit_v2 + + global __nvmlDeviceGetNvLinkState + data["__nvmlDeviceGetNvLinkState"] = __nvmlDeviceGetNvLinkState + + global __nvmlDeviceGetNvLinkVersion + data["__nvmlDeviceGetNvLinkVersion"] = __nvmlDeviceGetNvLinkVersion + + global __nvmlDeviceGetNvLinkCapability + data["__nvmlDeviceGetNvLinkCapability"] = __nvmlDeviceGetNvLinkCapability + + global __nvmlDeviceGetNvLinkRemotePciInfo_v2 + data["__nvmlDeviceGetNvLinkRemotePciInfo_v2"] = __nvmlDeviceGetNvLinkRemotePciInfo_v2 + + global __nvmlDeviceGetNvLinkErrorCounter + data["__nvmlDeviceGetNvLinkErrorCounter"] = __nvmlDeviceGetNvLinkErrorCounter + + global __nvmlDeviceResetNvLinkErrorCounters + data["__nvmlDeviceResetNvLinkErrorCounters"] = __nvmlDeviceResetNvLinkErrorCounters + + global __nvmlDeviceGetNvLinkRemoteDeviceType + data["__nvmlDeviceGetNvLinkRemoteDeviceType"] = __nvmlDeviceGetNvLinkRemoteDeviceType + + global __nvmlDeviceSetNvLinkDeviceLowPowerThreshold + data["__nvmlDeviceSetNvLinkDeviceLowPowerThreshold"] = __nvmlDeviceSetNvLinkDeviceLowPowerThreshold + + global __nvmlSystemSetNvlinkBwMode + data["__nvmlSystemSetNvlinkBwMode"] = __nvmlSystemSetNvlinkBwMode + + global __nvmlSystemGetNvlinkBwMode + data["__nvmlSystemGetNvlinkBwMode"] = __nvmlSystemGetNvlinkBwMode + + global __nvmlDeviceGetNvlinkSupportedBwModes + data["__nvmlDeviceGetNvlinkSupportedBwModes"] = __nvmlDeviceGetNvlinkSupportedBwModes + + global __nvmlDeviceGetNvlinkBwMode + data["__nvmlDeviceGetNvlinkBwMode"] = __nvmlDeviceGetNvlinkBwMode + + global __nvmlDeviceSetNvlinkBwMode + data["__nvmlDeviceSetNvlinkBwMode"] = __nvmlDeviceSetNvlinkBwMode + + global __nvmlEventSetCreate + data["__nvmlEventSetCreate"] = __nvmlEventSetCreate + + global __nvmlDeviceRegisterEvents + data["__nvmlDeviceRegisterEvents"] = __nvmlDeviceRegisterEvents + + global __nvmlDeviceGetSupportedEventTypes + data["__nvmlDeviceGetSupportedEventTypes"] = __nvmlDeviceGetSupportedEventTypes + + global __nvmlEventSetWait_v2 + data["__nvmlEventSetWait_v2"] = __nvmlEventSetWait_v2 + + global __nvmlEventSetFree + data["__nvmlEventSetFree"] = __nvmlEventSetFree + + global __nvmlSystemEventSetCreate + data["__nvmlSystemEventSetCreate"] = __nvmlSystemEventSetCreate + + global __nvmlSystemEventSetFree + data["__nvmlSystemEventSetFree"] = __nvmlSystemEventSetFree + + global __nvmlSystemRegisterEvents + data["__nvmlSystemRegisterEvents"] = __nvmlSystemRegisterEvents + + global __nvmlSystemEventSetWait + data["__nvmlSystemEventSetWait"] = __nvmlSystemEventSetWait + + global __nvmlDeviceModifyDrainState + data["__nvmlDeviceModifyDrainState"] = __nvmlDeviceModifyDrainState + + global __nvmlDeviceQueryDrainState + data["__nvmlDeviceQueryDrainState"] = __nvmlDeviceQueryDrainState + + global __nvmlDeviceRemoveGpu_v2 + data["__nvmlDeviceRemoveGpu_v2"] = __nvmlDeviceRemoveGpu_v2 + + global __nvmlDeviceDiscoverGpus + data["__nvmlDeviceDiscoverGpus"] = __nvmlDeviceDiscoverGpus + + global __nvmlDeviceGetFieldValues + data["__nvmlDeviceGetFieldValues"] = __nvmlDeviceGetFieldValues + + global __nvmlDeviceClearFieldValues + data["__nvmlDeviceClearFieldValues"] = __nvmlDeviceClearFieldValues + + global __nvmlDeviceGetVirtualizationMode + data["__nvmlDeviceGetVirtualizationMode"] = __nvmlDeviceGetVirtualizationMode + + global __nvmlDeviceGetHostVgpuMode + data["__nvmlDeviceGetHostVgpuMode"] = __nvmlDeviceGetHostVgpuMode + + global __nvmlDeviceSetVirtualizationMode + data["__nvmlDeviceSetVirtualizationMode"] = __nvmlDeviceSetVirtualizationMode + + global __nvmlDeviceGetVgpuHeterogeneousMode + data["__nvmlDeviceGetVgpuHeterogeneousMode"] = __nvmlDeviceGetVgpuHeterogeneousMode + + global __nvmlDeviceSetVgpuHeterogeneousMode + data["__nvmlDeviceSetVgpuHeterogeneousMode"] = __nvmlDeviceSetVgpuHeterogeneousMode + + global __nvmlVgpuInstanceGetPlacementId + data["__nvmlVgpuInstanceGetPlacementId"] = __nvmlVgpuInstanceGetPlacementId + + global __nvmlDeviceGetVgpuTypeSupportedPlacements + data["__nvmlDeviceGetVgpuTypeSupportedPlacements"] = __nvmlDeviceGetVgpuTypeSupportedPlacements + + global __nvmlDeviceGetVgpuTypeCreatablePlacements + data["__nvmlDeviceGetVgpuTypeCreatablePlacements"] = __nvmlDeviceGetVgpuTypeCreatablePlacements + + global __nvmlVgpuTypeGetGspHeapSize + data["__nvmlVgpuTypeGetGspHeapSize"] = __nvmlVgpuTypeGetGspHeapSize + + global __nvmlVgpuTypeGetFbReservation + data["__nvmlVgpuTypeGetFbReservation"] = __nvmlVgpuTypeGetFbReservation + + global __nvmlVgpuInstanceGetRuntimeStateSize + data["__nvmlVgpuInstanceGetRuntimeStateSize"] = __nvmlVgpuInstanceGetRuntimeStateSize + + global __nvmlDeviceSetVgpuCapabilities + data["__nvmlDeviceSetVgpuCapabilities"] = __nvmlDeviceSetVgpuCapabilities + + global __nvmlDeviceGetGridLicensableFeatures_v4 + data["__nvmlDeviceGetGridLicensableFeatures_v4"] = __nvmlDeviceGetGridLicensableFeatures_v4 + + global __nvmlGetVgpuDriverCapabilities + data["__nvmlGetVgpuDriverCapabilities"] = __nvmlGetVgpuDriverCapabilities + + global __nvmlDeviceGetVgpuCapabilities + data["__nvmlDeviceGetVgpuCapabilities"] = __nvmlDeviceGetVgpuCapabilities + + global __nvmlDeviceGetSupportedVgpus + data["__nvmlDeviceGetSupportedVgpus"] = __nvmlDeviceGetSupportedVgpus + + global __nvmlDeviceGetCreatableVgpus + data["__nvmlDeviceGetCreatableVgpus"] = __nvmlDeviceGetCreatableVgpus + + global __nvmlVgpuTypeGetClass + data["__nvmlVgpuTypeGetClass"] = __nvmlVgpuTypeGetClass + + global __nvmlVgpuTypeGetName + data["__nvmlVgpuTypeGetName"] = __nvmlVgpuTypeGetName + + global __nvmlVgpuTypeGetGpuInstanceProfileId + data["__nvmlVgpuTypeGetGpuInstanceProfileId"] = __nvmlVgpuTypeGetGpuInstanceProfileId + + global __nvmlVgpuTypeGetDeviceID + data["__nvmlVgpuTypeGetDeviceID"] = __nvmlVgpuTypeGetDeviceID + + global __nvmlVgpuTypeGetFramebufferSize + data["__nvmlVgpuTypeGetFramebufferSize"] = __nvmlVgpuTypeGetFramebufferSize + + global __nvmlVgpuTypeGetNumDisplayHeads + data["__nvmlVgpuTypeGetNumDisplayHeads"] = __nvmlVgpuTypeGetNumDisplayHeads + + global __nvmlVgpuTypeGetResolution + data["__nvmlVgpuTypeGetResolution"] = __nvmlVgpuTypeGetResolution + + global __nvmlVgpuTypeGetLicense + data["__nvmlVgpuTypeGetLicense"] = __nvmlVgpuTypeGetLicense + + global __nvmlVgpuTypeGetFrameRateLimit + data["__nvmlVgpuTypeGetFrameRateLimit"] = __nvmlVgpuTypeGetFrameRateLimit + + global __nvmlVgpuTypeGetMaxInstances + data["__nvmlVgpuTypeGetMaxInstances"] = __nvmlVgpuTypeGetMaxInstances + + global __nvmlVgpuTypeGetMaxInstancesPerVm + data["__nvmlVgpuTypeGetMaxInstancesPerVm"] = __nvmlVgpuTypeGetMaxInstancesPerVm + + global __nvmlVgpuTypeGetBAR1Info + data["__nvmlVgpuTypeGetBAR1Info"] = __nvmlVgpuTypeGetBAR1Info + + global __nvmlDeviceGetActiveVgpus + data["__nvmlDeviceGetActiveVgpus"] = __nvmlDeviceGetActiveVgpus + + global __nvmlVgpuInstanceGetVmID + data["__nvmlVgpuInstanceGetVmID"] = __nvmlVgpuInstanceGetVmID + + global __nvmlVgpuInstanceGetUUID + data["__nvmlVgpuInstanceGetUUID"] = __nvmlVgpuInstanceGetUUID + + global __nvmlVgpuInstanceGetVmDriverVersion + data["__nvmlVgpuInstanceGetVmDriverVersion"] = __nvmlVgpuInstanceGetVmDriverVersion + + global __nvmlVgpuInstanceGetFbUsage + data["__nvmlVgpuInstanceGetFbUsage"] = __nvmlVgpuInstanceGetFbUsage + + global __nvmlVgpuInstanceGetLicenseStatus + data["__nvmlVgpuInstanceGetLicenseStatus"] = __nvmlVgpuInstanceGetLicenseStatus + + global __nvmlVgpuInstanceGetType + data["__nvmlVgpuInstanceGetType"] = __nvmlVgpuInstanceGetType + + global __nvmlVgpuInstanceGetFrameRateLimit + data["__nvmlVgpuInstanceGetFrameRateLimit"] = __nvmlVgpuInstanceGetFrameRateLimit + + global __nvmlVgpuInstanceGetEccMode + data["__nvmlVgpuInstanceGetEccMode"] = __nvmlVgpuInstanceGetEccMode + + global __nvmlVgpuInstanceGetEncoderCapacity + data["__nvmlVgpuInstanceGetEncoderCapacity"] = __nvmlVgpuInstanceGetEncoderCapacity + + global __nvmlVgpuInstanceSetEncoderCapacity + data["__nvmlVgpuInstanceSetEncoderCapacity"] = __nvmlVgpuInstanceSetEncoderCapacity + + global __nvmlVgpuInstanceGetEncoderStats + data["__nvmlVgpuInstanceGetEncoderStats"] = __nvmlVgpuInstanceGetEncoderStats + + global __nvmlVgpuInstanceGetEncoderSessions + data["__nvmlVgpuInstanceGetEncoderSessions"] = __nvmlVgpuInstanceGetEncoderSessions + + global __nvmlVgpuInstanceGetFBCStats + data["__nvmlVgpuInstanceGetFBCStats"] = __nvmlVgpuInstanceGetFBCStats + + global __nvmlVgpuInstanceGetFBCSessions + data["__nvmlVgpuInstanceGetFBCSessions"] = __nvmlVgpuInstanceGetFBCSessions + + global __nvmlVgpuInstanceGetGpuInstanceId + data["__nvmlVgpuInstanceGetGpuInstanceId"] = __nvmlVgpuInstanceGetGpuInstanceId + + global __nvmlVgpuInstanceGetGpuPciId + data["__nvmlVgpuInstanceGetGpuPciId"] = __nvmlVgpuInstanceGetGpuPciId + + global __nvmlVgpuTypeGetCapabilities + data["__nvmlVgpuTypeGetCapabilities"] = __nvmlVgpuTypeGetCapabilities + + global __nvmlVgpuInstanceGetMdevUUID + data["__nvmlVgpuInstanceGetMdevUUID"] = __nvmlVgpuInstanceGetMdevUUID + + global __nvmlGpuInstanceGetCreatableVgpus + data["__nvmlGpuInstanceGetCreatableVgpus"] = __nvmlGpuInstanceGetCreatableVgpus + + global __nvmlVgpuTypeGetMaxInstancesPerGpuInstance + data["__nvmlVgpuTypeGetMaxInstancesPerGpuInstance"] = __nvmlVgpuTypeGetMaxInstancesPerGpuInstance + + global __nvmlGpuInstanceGetActiveVgpus + data["__nvmlGpuInstanceGetActiveVgpus"] = __nvmlGpuInstanceGetActiveVgpus + + global __nvmlGpuInstanceSetVgpuSchedulerState + data["__nvmlGpuInstanceSetVgpuSchedulerState"] = __nvmlGpuInstanceSetVgpuSchedulerState + + global __nvmlGpuInstanceGetVgpuSchedulerState + data["__nvmlGpuInstanceGetVgpuSchedulerState"] = __nvmlGpuInstanceGetVgpuSchedulerState + + global __nvmlGpuInstanceGetVgpuSchedulerLog + data["__nvmlGpuInstanceGetVgpuSchedulerLog"] = __nvmlGpuInstanceGetVgpuSchedulerLog + + global __nvmlGpuInstanceGetVgpuTypeCreatablePlacements + data["__nvmlGpuInstanceGetVgpuTypeCreatablePlacements"] = __nvmlGpuInstanceGetVgpuTypeCreatablePlacements + + global __nvmlGpuInstanceGetVgpuHeterogeneousMode + data["__nvmlGpuInstanceGetVgpuHeterogeneousMode"] = __nvmlGpuInstanceGetVgpuHeterogeneousMode + + global __nvmlGpuInstanceSetVgpuHeterogeneousMode + data["__nvmlGpuInstanceSetVgpuHeterogeneousMode"] = __nvmlGpuInstanceSetVgpuHeterogeneousMode + + global __nvmlVgpuInstanceGetMetadata + data["__nvmlVgpuInstanceGetMetadata"] = __nvmlVgpuInstanceGetMetadata + + global __nvmlDeviceGetVgpuMetadata + data["__nvmlDeviceGetVgpuMetadata"] = __nvmlDeviceGetVgpuMetadata + + global __nvmlGetVgpuCompatibility + data["__nvmlGetVgpuCompatibility"] = __nvmlGetVgpuCompatibility + + global __nvmlDeviceGetPgpuMetadataString + data["__nvmlDeviceGetPgpuMetadataString"] = __nvmlDeviceGetPgpuMetadataString + + global __nvmlDeviceGetVgpuSchedulerLog + data["__nvmlDeviceGetVgpuSchedulerLog"] = __nvmlDeviceGetVgpuSchedulerLog + + global __nvmlDeviceGetVgpuSchedulerState + data["__nvmlDeviceGetVgpuSchedulerState"] = __nvmlDeviceGetVgpuSchedulerState + + global __nvmlDeviceGetVgpuSchedulerCapabilities + data["__nvmlDeviceGetVgpuSchedulerCapabilities"] = __nvmlDeviceGetVgpuSchedulerCapabilities + + global __nvmlDeviceSetVgpuSchedulerState + data["__nvmlDeviceSetVgpuSchedulerState"] = __nvmlDeviceSetVgpuSchedulerState + + global __nvmlGetVgpuVersion + data["__nvmlGetVgpuVersion"] = __nvmlGetVgpuVersion + + global __nvmlSetVgpuVersion + data["__nvmlSetVgpuVersion"] = __nvmlSetVgpuVersion + + global __nvmlDeviceGetVgpuUtilization + data["__nvmlDeviceGetVgpuUtilization"] = __nvmlDeviceGetVgpuUtilization + + global __nvmlDeviceGetVgpuInstancesUtilizationInfo + data["__nvmlDeviceGetVgpuInstancesUtilizationInfo"] = __nvmlDeviceGetVgpuInstancesUtilizationInfo + + global __nvmlDeviceGetVgpuProcessUtilization + data["__nvmlDeviceGetVgpuProcessUtilization"] = __nvmlDeviceGetVgpuProcessUtilization + + global __nvmlDeviceGetVgpuProcessesUtilizationInfo + data["__nvmlDeviceGetVgpuProcessesUtilizationInfo"] = __nvmlDeviceGetVgpuProcessesUtilizationInfo + + global __nvmlVgpuInstanceGetAccountingMode + data["__nvmlVgpuInstanceGetAccountingMode"] = __nvmlVgpuInstanceGetAccountingMode + + global __nvmlVgpuInstanceGetAccountingPids + data["__nvmlVgpuInstanceGetAccountingPids"] = __nvmlVgpuInstanceGetAccountingPids + + global __nvmlVgpuInstanceGetAccountingStats + data["__nvmlVgpuInstanceGetAccountingStats"] = __nvmlVgpuInstanceGetAccountingStats + + global __nvmlVgpuInstanceClearAccountingPids + data["__nvmlVgpuInstanceClearAccountingPids"] = __nvmlVgpuInstanceClearAccountingPids + + global __nvmlVgpuInstanceGetLicenseInfo_v2 + data["__nvmlVgpuInstanceGetLicenseInfo_v2"] = __nvmlVgpuInstanceGetLicenseInfo_v2 + + global __nvmlGetExcludedDeviceCount + data["__nvmlGetExcludedDeviceCount"] = __nvmlGetExcludedDeviceCount + + global __nvmlGetExcludedDeviceInfoByIndex + data["__nvmlGetExcludedDeviceInfoByIndex"] = __nvmlGetExcludedDeviceInfoByIndex + + global __nvmlDeviceSetMigMode + data["__nvmlDeviceSetMigMode"] = __nvmlDeviceSetMigMode + + global __nvmlDeviceGetMigMode + data["__nvmlDeviceGetMigMode"] = __nvmlDeviceGetMigMode + + global __nvmlDeviceGetGpuInstanceProfileInfoV + data["__nvmlDeviceGetGpuInstanceProfileInfoV"] = __nvmlDeviceGetGpuInstanceProfileInfoV + + global __nvmlDeviceGetGpuInstancePossiblePlacements_v2 + data["__nvmlDeviceGetGpuInstancePossiblePlacements_v2"] = __nvmlDeviceGetGpuInstancePossiblePlacements_v2 + + global __nvmlDeviceGetGpuInstanceRemainingCapacity + data["__nvmlDeviceGetGpuInstanceRemainingCapacity"] = __nvmlDeviceGetGpuInstanceRemainingCapacity + + global __nvmlDeviceCreateGpuInstance + data["__nvmlDeviceCreateGpuInstance"] = __nvmlDeviceCreateGpuInstance + + global __nvmlDeviceCreateGpuInstanceWithPlacement + data["__nvmlDeviceCreateGpuInstanceWithPlacement"] = __nvmlDeviceCreateGpuInstanceWithPlacement + + global __nvmlGpuInstanceDestroy + data["__nvmlGpuInstanceDestroy"] = __nvmlGpuInstanceDestroy + + global __nvmlDeviceGetGpuInstances + data["__nvmlDeviceGetGpuInstances"] = __nvmlDeviceGetGpuInstances + + global __nvmlDeviceGetGpuInstanceById + data["__nvmlDeviceGetGpuInstanceById"] = __nvmlDeviceGetGpuInstanceById + + global __nvmlGpuInstanceGetInfo + data["__nvmlGpuInstanceGetInfo"] = __nvmlGpuInstanceGetInfo + + global __nvmlGpuInstanceGetComputeInstanceProfileInfoV + data["__nvmlGpuInstanceGetComputeInstanceProfileInfoV"] = __nvmlGpuInstanceGetComputeInstanceProfileInfoV + + global __nvmlGpuInstanceGetComputeInstanceRemainingCapacity + data["__nvmlGpuInstanceGetComputeInstanceRemainingCapacity"] = __nvmlGpuInstanceGetComputeInstanceRemainingCapacity + + global __nvmlGpuInstanceGetComputeInstancePossiblePlacements + data["__nvmlGpuInstanceGetComputeInstancePossiblePlacements"] = __nvmlGpuInstanceGetComputeInstancePossiblePlacements + + global __nvmlGpuInstanceCreateComputeInstance + data["__nvmlGpuInstanceCreateComputeInstance"] = __nvmlGpuInstanceCreateComputeInstance + + global __nvmlGpuInstanceCreateComputeInstanceWithPlacement + data["__nvmlGpuInstanceCreateComputeInstanceWithPlacement"] = __nvmlGpuInstanceCreateComputeInstanceWithPlacement + + global __nvmlComputeInstanceDestroy + data["__nvmlComputeInstanceDestroy"] = __nvmlComputeInstanceDestroy + + global __nvmlGpuInstanceGetComputeInstances + data["__nvmlGpuInstanceGetComputeInstances"] = __nvmlGpuInstanceGetComputeInstances + + global __nvmlGpuInstanceGetComputeInstanceById + data["__nvmlGpuInstanceGetComputeInstanceById"] = __nvmlGpuInstanceGetComputeInstanceById + + global __nvmlComputeInstanceGetInfo_v2 + data["__nvmlComputeInstanceGetInfo_v2"] = __nvmlComputeInstanceGetInfo_v2 + + global __nvmlDeviceIsMigDeviceHandle + data["__nvmlDeviceIsMigDeviceHandle"] = __nvmlDeviceIsMigDeviceHandle + + global __nvmlDeviceGetGpuInstanceId + data["__nvmlDeviceGetGpuInstanceId"] = __nvmlDeviceGetGpuInstanceId + + global __nvmlDeviceGetComputeInstanceId + data["__nvmlDeviceGetComputeInstanceId"] = __nvmlDeviceGetComputeInstanceId + + global __nvmlDeviceGetMaxMigDeviceCount + data["__nvmlDeviceGetMaxMigDeviceCount"] = __nvmlDeviceGetMaxMigDeviceCount + + global __nvmlDeviceGetMigDeviceHandleByIndex + data["__nvmlDeviceGetMigDeviceHandleByIndex"] = __nvmlDeviceGetMigDeviceHandleByIndex + + global __nvmlDeviceGetDeviceHandleFromMigDeviceHandle + data["__nvmlDeviceGetDeviceHandleFromMigDeviceHandle"] = __nvmlDeviceGetDeviceHandleFromMigDeviceHandle + + global __nvmlGpmSampleGet + data["__nvmlGpmSampleGet"] = __nvmlGpmSampleGet + + global __nvmlGpmMigSampleGet + data["__nvmlGpmMigSampleGet"] = __nvmlGpmMigSampleGet + + global __nvmlGpmQueryDeviceSupport + data["__nvmlGpmQueryDeviceSupport"] = __nvmlGpmQueryDeviceSupport + + global __nvmlGpmQueryIfStreamingEnabled + data["__nvmlGpmQueryIfStreamingEnabled"] = __nvmlGpmQueryIfStreamingEnabled + + global __nvmlGpmSetStreamingEnabled + data["__nvmlGpmSetStreamingEnabled"] = __nvmlGpmSetStreamingEnabled + + global __nvmlDeviceGetCapabilities + data["__nvmlDeviceGetCapabilities"] = __nvmlDeviceGetCapabilities + + global __nvmlDeviceWorkloadPowerProfileClearRequestedProfiles + data["__nvmlDeviceWorkloadPowerProfileClearRequestedProfiles"] = __nvmlDeviceWorkloadPowerProfileClearRequestedProfiles + + global __nvmlDevicePowerSmoothingActivatePresetProfile + data["__nvmlDevicePowerSmoothingActivatePresetProfile"] = __nvmlDevicePowerSmoothingActivatePresetProfile + + global __nvmlDevicePowerSmoothingUpdatePresetProfileParam + data["__nvmlDevicePowerSmoothingUpdatePresetProfileParam"] = __nvmlDevicePowerSmoothingUpdatePresetProfileParam + + global __nvmlDevicePowerSmoothingSetState + data["__nvmlDevicePowerSmoothingSetState"] = __nvmlDevicePowerSmoothingSetState + + global __nvmlDeviceGetAddressingMode + data["__nvmlDeviceGetAddressingMode"] = __nvmlDeviceGetAddressingMode + + global __nvmlDeviceGetRepairStatus + data["__nvmlDeviceGetRepairStatus"] = __nvmlDeviceGetRepairStatus + + global __nvmlDeviceGetPowerMizerMode_v1 + data["__nvmlDeviceGetPowerMizerMode_v1"] = __nvmlDeviceGetPowerMizerMode_v1 + + global __nvmlDeviceSetPowerMizerMode_v1 + data["__nvmlDeviceSetPowerMizerMode_v1"] = __nvmlDeviceSetPowerMizerMode_v1 + + global __nvmlDeviceGetPdi + data["__nvmlDeviceGetPdi"] = __nvmlDeviceGetPdi + + global __nvmlDeviceSetHostname_v1 + data["__nvmlDeviceSetHostname_v1"] = __nvmlDeviceSetHostname_v1 + + global __nvmlDeviceGetHostname_v1 + data["__nvmlDeviceGetHostname_v1"] = __nvmlDeviceGetHostname_v1 + + global __nvmlDeviceGetNvLinkInfo + data["__nvmlDeviceGetNvLinkInfo"] = __nvmlDeviceGetNvLinkInfo + + global __nvmlDeviceReadWritePRM_v1 + data["__nvmlDeviceReadWritePRM_v1"] = __nvmlDeviceReadWritePRM_v1 + + global __nvmlDeviceGetGpuInstanceProfileInfoByIdV + data["__nvmlDeviceGetGpuInstanceProfileInfoByIdV"] = __nvmlDeviceGetGpuInstanceProfileInfoByIdV + + global __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts + data["__nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts"] = __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts + + func_ptrs = data + return data + + +cpdef _inspect_function_pointer(str name): + global func_ptrs + if func_ptrs is None: + func_ptrs = _inspect_function_pointers() + return func_ptrs[name] + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef nvmlReturn_t _nvmlInit_v2() except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlInit_v2 + _check_or_init_nvml() + if __nvmlInit_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlInit_v2 is not found") + return (__nvmlInit_v2)( + ) + + +cdef nvmlReturn_t _nvmlInitWithFlags(unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlInitWithFlags + _check_or_init_nvml() + if __nvmlInitWithFlags == NULL: + with gil: + raise FunctionNotFoundError("function nvmlInitWithFlags is not found") + return (__nvmlInitWithFlags)( + flags) + + +cdef nvmlReturn_t _nvmlShutdown() except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlShutdown + _check_or_init_nvml() + if __nvmlShutdown == NULL: + with gil: + raise FunctionNotFoundError("function nvmlShutdown is not found") + return (__nvmlShutdown)( + ) + + +cdef const char* _nvmlErrorString(nvmlReturn_t result) except?NULL nogil: + global __nvmlErrorString + _check_or_init_nvml() + if __nvmlErrorString == NULL: + with gil: + raise FunctionNotFoundError("function nvmlErrorString is not found") + return (__nvmlErrorString)( + result) + + +cdef nvmlReturn_t _nvmlSystemGetDriverVersion(char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetDriverVersion + _check_or_init_nvml() + if __nvmlSystemGetDriverVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetDriverVersion is not found") + return (__nvmlSystemGetDriverVersion)( + version, length) + + +cdef nvmlReturn_t _nvmlSystemGetNVMLVersion(char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetNVMLVersion + _check_or_init_nvml() + if __nvmlSystemGetNVMLVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetNVMLVersion is not found") + return (__nvmlSystemGetNVMLVersion)( + version, length) + + +cdef nvmlReturn_t _nvmlSystemGetCudaDriverVersion(int* cudaDriverVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetCudaDriverVersion + _check_or_init_nvml() + if __nvmlSystemGetCudaDriverVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetCudaDriverVersion is not found") + return (__nvmlSystemGetCudaDriverVersion)( + cudaDriverVersion) + + +cdef nvmlReturn_t _nvmlSystemGetCudaDriverVersion_v2(int* cudaDriverVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetCudaDriverVersion_v2 + _check_or_init_nvml() + if __nvmlSystemGetCudaDriverVersion_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetCudaDriverVersion_v2 is not found") + return (__nvmlSystemGetCudaDriverVersion_v2)( + cudaDriverVersion) + + +cdef nvmlReturn_t _nvmlSystemGetProcessName(unsigned int pid, char* name, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetProcessName + _check_or_init_nvml() + if __nvmlSystemGetProcessName == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetProcessName is not found") + return (__nvmlSystemGetProcessName)( + pid, name, length) + + +cdef nvmlReturn_t _nvmlSystemGetHicVersion(unsigned int* hwbcCount, nvmlHwbcEntry_t* hwbcEntries) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetHicVersion + _check_or_init_nvml() + if __nvmlSystemGetHicVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetHicVersion is not found") + return (__nvmlSystemGetHicVersion)( + hwbcCount, hwbcEntries) + + +cdef nvmlReturn_t _nvmlSystemGetTopologyGpuSet(unsigned int cpuNumber, unsigned int* count, nvmlDevice_t* deviceArray) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetTopologyGpuSet + _check_or_init_nvml() + if __nvmlSystemGetTopologyGpuSet == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetTopologyGpuSet is not found") + return (__nvmlSystemGetTopologyGpuSet)( + cpuNumber, count, deviceArray) + + +cdef nvmlReturn_t _nvmlSystemGetDriverBranch(nvmlSystemDriverBranchInfo_t* branchInfo, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetDriverBranch + _check_or_init_nvml() + if __nvmlSystemGetDriverBranch == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetDriverBranch is not found") + return (__nvmlSystemGetDriverBranch)( + branchInfo, length) + + +cdef nvmlReturn_t _nvmlUnitGetCount(unsigned int* unitCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetCount + _check_or_init_nvml() + if __nvmlUnitGetCount == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetCount is not found") + return (__nvmlUnitGetCount)( + unitCount) + + +cdef nvmlReturn_t _nvmlUnitGetHandleByIndex(unsigned int index, nvmlUnit_t* unit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetHandleByIndex + _check_or_init_nvml() + if __nvmlUnitGetHandleByIndex == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetHandleByIndex is not found") + return (__nvmlUnitGetHandleByIndex)( + index, unit) + + +cdef nvmlReturn_t _nvmlUnitGetUnitInfo(nvmlUnit_t unit, nvmlUnitInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetUnitInfo + _check_or_init_nvml() + if __nvmlUnitGetUnitInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetUnitInfo is not found") + return (__nvmlUnitGetUnitInfo)( + unit, info) + + +cdef nvmlReturn_t _nvmlUnitGetLedState(nvmlUnit_t unit, nvmlLedState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetLedState + _check_or_init_nvml() + if __nvmlUnitGetLedState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetLedState is not found") + return (__nvmlUnitGetLedState)( + unit, state) + + +cdef nvmlReturn_t _nvmlUnitGetPsuInfo(nvmlUnit_t unit, nvmlPSUInfo_t* psu) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetPsuInfo + _check_or_init_nvml() + if __nvmlUnitGetPsuInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetPsuInfo is not found") + return (__nvmlUnitGetPsuInfo)( + unit, psu) + + +cdef nvmlReturn_t _nvmlUnitGetTemperature(nvmlUnit_t unit, unsigned int type, unsigned int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetTemperature + _check_or_init_nvml() + if __nvmlUnitGetTemperature == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetTemperature is not found") + return (__nvmlUnitGetTemperature)( + unit, type, temp) + + +cdef nvmlReturn_t _nvmlUnitGetFanSpeedInfo(nvmlUnit_t unit, nvmlUnitFanSpeeds_t* fanSpeeds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetFanSpeedInfo + _check_or_init_nvml() + if __nvmlUnitGetFanSpeedInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetFanSpeedInfo is not found") + return (__nvmlUnitGetFanSpeedInfo)( + unit, fanSpeeds) + + +cdef nvmlReturn_t _nvmlUnitGetDevices(nvmlUnit_t unit, unsigned int* deviceCount, nvmlDevice_t* devices) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetDevices + _check_or_init_nvml() + if __nvmlUnitGetDevices == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetDevices is not found") + return (__nvmlUnitGetDevices)( + unit, deviceCount, devices) + + +cdef nvmlReturn_t _nvmlDeviceGetCount_v2(unsigned int* deviceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCount_v2 + _check_or_init_nvml() + if __nvmlDeviceGetCount_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCount_v2 is not found") + return (__nvmlDeviceGetCount_v2)( + deviceCount) + + +cdef nvmlReturn_t _nvmlDeviceGetAttributes_v2(nvmlDevice_t device, nvmlDeviceAttributes_t* attributes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAttributes_v2 + _check_or_init_nvml() + if __nvmlDeviceGetAttributes_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAttributes_v2 is not found") + return (__nvmlDeviceGetAttributes_v2)( + device, attributes) + + +cdef nvmlReturn_t _nvmlDeviceGetHandleByIndex_v2(unsigned int index, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHandleByIndex_v2 + _check_or_init_nvml() + if __nvmlDeviceGetHandleByIndex_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHandleByIndex_v2 is not found") + return (__nvmlDeviceGetHandleByIndex_v2)( + index, device) + + +cdef nvmlReturn_t _nvmlDeviceGetHandleBySerial(const char* serial, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHandleBySerial + _check_or_init_nvml() + if __nvmlDeviceGetHandleBySerial == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHandleBySerial is not found") + return (__nvmlDeviceGetHandleBySerial)( + serial, device) + + +cdef nvmlReturn_t _nvmlDeviceGetHandleByUUID(const char* uuid, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHandleByUUID + _check_or_init_nvml() + if __nvmlDeviceGetHandleByUUID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHandleByUUID is not found") + return (__nvmlDeviceGetHandleByUUID)( + uuid, device) + + +cdef nvmlReturn_t _nvmlDeviceGetHandleByUUIDV(const nvmlUUID_t* uuid, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHandleByUUIDV + _check_or_init_nvml() + if __nvmlDeviceGetHandleByUUIDV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHandleByUUIDV is not found") + return (__nvmlDeviceGetHandleByUUIDV)( + uuid, device) + + +cdef nvmlReturn_t _nvmlDeviceGetHandleByPciBusId_v2(const char* pciBusId, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHandleByPciBusId_v2 + _check_or_init_nvml() + if __nvmlDeviceGetHandleByPciBusId_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHandleByPciBusId_v2 is not found") + return (__nvmlDeviceGetHandleByPciBusId_v2)( + pciBusId, device) + + +cdef nvmlReturn_t _nvmlDeviceGetName(nvmlDevice_t device, char* name, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetName + _check_or_init_nvml() + if __nvmlDeviceGetName == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetName is not found") + return (__nvmlDeviceGetName)( + device, name, length) + + +cdef nvmlReturn_t _nvmlDeviceGetBrand(nvmlDevice_t device, nvmlBrandType_t* type) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBrand + _check_or_init_nvml() + if __nvmlDeviceGetBrand == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBrand is not found") + return (__nvmlDeviceGetBrand)( + device, type) + + +cdef nvmlReturn_t _nvmlDeviceGetIndex(nvmlDevice_t device, unsigned int* index) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetIndex + _check_or_init_nvml() + if __nvmlDeviceGetIndex == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetIndex is not found") + return (__nvmlDeviceGetIndex)( + device, index) + + +cdef nvmlReturn_t _nvmlDeviceGetSerial(nvmlDevice_t device, char* serial, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSerial + _check_or_init_nvml() + if __nvmlDeviceGetSerial == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSerial is not found") + return (__nvmlDeviceGetSerial)( + device, serial, length) + + +cdef nvmlReturn_t _nvmlDeviceGetModuleId(nvmlDevice_t device, unsigned int* moduleId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetModuleId + _check_or_init_nvml() + if __nvmlDeviceGetModuleId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetModuleId is not found") + return (__nvmlDeviceGetModuleId)( + device, moduleId) + + +cdef nvmlReturn_t _nvmlDeviceGetC2cModeInfoV(nvmlDevice_t device, nvmlC2cModeInfo_v1_t* c2cModeInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetC2cModeInfoV + _check_or_init_nvml() + if __nvmlDeviceGetC2cModeInfoV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetC2cModeInfoV is not found") + return (__nvmlDeviceGetC2cModeInfoV)( + device, c2cModeInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetMemoryAffinity(nvmlDevice_t device, unsigned int nodeSetSize, unsigned long* nodeSet, nvmlAffinityScope_t scope) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemoryAffinity + _check_or_init_nvml() + if __nvmlDeviceGetMemoryAffinity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemoryAffinity is not found") + return (__nvmlDeviceGetMemoryAffinity)( + device, nodeSetSize, nodeSet, scope) + + +cdef nvmlReturn_t _nvmlDeviceGetCpuAffinityWithinScope(nvmlDevice_t device, unsigned int cpuSetSize, unsigned long* cpuSet, nvmlAffinityScope_t scope) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCpuAffinityWithinScope + _check_or_init_nvml() + if __nvmlDeviceGetCpuAffinityWithinScope == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCpuAffinityWithinScope is not found") + return (__nvmlDeviceGetCpuAffinityWithinScope)( + device, cpuSetSize, cpuSet, scope) + + +cdef nvmlReturn_t _nvmlDeviceGetCpuAffinity(nvmlDevice_t device, unsigned int cpuSetSize, unsigned long* cpuSet) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCpuAffinity + _check_or_init_nvml() + if __nvmlDeviceGetCpuAffinity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCpuAffinity is not found") + return (__nvmlDeviceGetCpuAffinity)( + device, cpuSetSize, cpuSet) + + +cdef nvmlReturn_t _nvmlDeviceSetCpuAffinity(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetCpuAffinity + _check_or_init_nvml() + if __nvmlDeviceSetCpuAffinity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetCpuAffinity is not found") + return (__nvmlDeviceSetCpuAffinity)( + device) + + +cdef nvmlReturn_t _nvmlDeviceClearCpuAffinity(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceClearCpuAffinity + _check_or_init_nvml() + if __nvmlDeviceClearCpuAffinity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceClearCpuAffinity is not found") + return (__nvmlDeviceClearCpuAffinity)( + device) + + +cdef nvmlReturn_t _nvmlDeviceGetNumaNodeId(nvmlDevice_t device, unsigned int* node) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNumaNodeId + _check_or_init_nvml() + if __nvmlDeviceGetNumaNodeId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNumaNodeId is not found") + return (__nvmlDeviceGetNumaNodeId)( + device, node) + + +cdef nvmlReturn_t _nvmlDeviceGetTopologyCommonAncestor(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuTopologyLevel_t* pathInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTopologyCommonAncestor + _check_or_init_nvml() + if __nvmlDeviceGetTopologyCommonAncestor == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTopologyCommonAncestor is not found") + return (__nvmlDeviceGetTopologyCommonAncestor)( + device1, device2, pathInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetTopologyNearestGpus(nvmlDevice_t device, nvmlGpuTopologyLevel_t level, unsigned int* count, nvmlDevice_t* deviceArray) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTopologyNearestGpus + _check_or_init_nvml() + if __nvmlDeviceGetTopologyNearestGpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTopologyNearestGpus is not found") + return (__nvmlDeviceGetTopologyNearestGpus)( + device, level, count, deviceArray) + + +cdef nvmlReturn_t _nvmlDeviceGetP2PStatus(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuP2PCapsIndex_t p2pIndex, nvmlGpuP2PStatus_t* p2pStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetP2PStatus + _check_or_init_nvml() + if __nvmlDeviceGetP2PStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetP2PStatus is not found") + return (__nvmlDeviceGetP2PStatus)( + device1, device2, p2pIndex, p2pStatus) + + +cdef nvmlReturn_t _nvmlDeviceGetUUID(nvmlDevice_t device, char* uuid, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetUUID + _check_or_init_nvml() + if __nvmlDeviceGetUUID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetUUID is not found") + return (__nvmlDeviceGetUUID)( + device, uuid, length) + + +cdef nvmlReturn_t _nvmlDeviceGetMinorNumber(nvmlDevice_t device, unsigned int* minorNumber) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMinorNumber + _check_or_init_nvml() + if __nvmlDeviceGetMinorNumber == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMinorNumber is not found") + return (__nvmlDeviceGetMinorNumber)( + device, minorNumber) + + +cdef nvmlReturn_t _nvmlDeviceGetBoardPartNumber(nvmlDevice_t device, char* partNumber, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBoardPartNumber + _check_or_init_nvml() + if __nvmlDeviceGetBoardPartNumber == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBoardPartNumber is not found") + return (__nvmlDeviceGetBoardPartNumber)( + device, partNumber, length) + + +cdef nvmlReturn_t _nvmlDeviceGetInforomVersion(nvmlDevice_t device, nvmlInforomObject_t object, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetInforomVersion + _check_or_init_nvml() + if __nvmlDeviceGetInforomVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetInforomVersion is not found") + return (__nvmlDeviceGetInforomVersion)( + device, object, version, length) + + +cdef nvmlReturn_t _nvmlDeviceGetInforomImageVersion(nvmlDevice_t device, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetInforomImageVersion + _check_or_init_nvml() + if __nvmlDeviceGetInforomImageVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetInforomImageVersion is not found") + return (__nvmlDeviceGetInforomImageVersion)( + device, version, length) + + +cdef nvmlReturn_t _nvmlDeviceGetInforomConfigurationChecksum(nvmlDevice_t device, unsigned int* checksum) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetInforomConfigurationChecksum + _check_or_init_nvml() + if __nvmlDeviceGetInforomConfigurationChecksum == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetInforomConfigurationChecksum is not found") + return (__nvmlDeviceGetInforomConfigurationChecksum)( + device, checksum) + + +cdef nvmlReturn_t _nvmlDeviceValidateInforom(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceValidateInforom + _check_or_init_nvml() + if __nvmlDeviceValidateInforom == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceValidateInforom is not found") + return (__nvmlDeviceValidateInforom)( + device) + + +cdef nvmlReturn_t _nvmlDeviceGetLastBBXFlushTime(nvmlDevice_t device, unsigned long long* timestamp, unsigned long* durationUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetLastBBXFlushTime + _check_or_init_nvml() + if __nvmlDeviceGetLastBBXFlushTime == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetLastBBXFlushTime is not found") + return (__nvmlDeviceGetLastBBXFlushTime)( + device, timestamp, durationUs) + + +cdef nvmlReturn_t _nvmlDeviceGetDisplayMode(nvmlDevice_t device, nvmlEnableState_t* display) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDisplayMode + _check_or_init_nvml() + if __nvmlDeviceGetDisplayMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDisplayMode is not found") + return (__nvmlDeviceGetDisplayMode)( + device, display) + + +cdef nvmlReturn_t _nvmlDeviceGetDisplayActive(nvmlDevice_t device, nvmlEnableState_t* isActive) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDisplayActive + _check_or_init_nvml() + if __nvmlDeviceGetDisplayActive == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDisplayActive is not found") + return (__nvmlDeviceGetDisplayActive)( + device, isActive) + + +cdef nvmlReturn_t _nvmlDeviceGetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPersistenceMode + _check_or_init_nvml() + if __nvmlDeviceGetPersistenceMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPersistenceMode is not found") + return (__nvmlDeviceGetPersistenceMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceGetPciInfoExt(nvmlDevice_t device, nvmlPciInfoExt_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPciInfoExt + _check_or_init_nvml() + if __nvmlDeviceGetPciInfoExt == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPciInfoExt is not found") + return (__nvmlDeviceGetPciInfoExt)( + device, pci) + + +cdef nvmlReturn_t _nvmlDeviceGetPciInfo_v3(nvmlDevice_t device, nvmlPciInfo_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPciInfo_v3 + _check_or_init_nvml() + if __nvmlDeviceGetPciInfo_v3 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPciInfo_v3 is not found") + return (__nvmlDeviceGetPciInfo_v3)( + device, pci) + + +cdef nvmlReturn_t _nvmlDeviceGetMaxPcieLinkGeneration(nvmlDevice_t device, unsigned int* maxLinkGen) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMaxPcieLinkGeneration + _check_or_init_nvml() + if __nvmlDeviceGetMaxPcieLinkGeneration == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMaxPcieLinkGeneration is not found") + return (__nvmlDeviceGetMaxPcieLinkGeneration)( + device, maxLinkGen) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuMaxPcieLinkGeneration(nvmlDevice_t device, unsigned int* maxLinkGenDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuMaxPcieLinkGeneration + _check_or_init_nvml() + if __nvmlDeviceGetGpuMaxPcieLinkGeneration == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuMaxPcieLinkGeneration is not found") + return (__nvmlDeviceGetGpuMaxPcieLinkGeneration)( + device, maxLinkGenDevice) + + +cdef nvmlReturn_t _nvmlDeviceGetMaxPcieLinkWidth(nvmlDevice_t device, unsigned int* maxLinkWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMaxPcieLinkWidth + _check_or_init_nvml() + if __nvmlDeviceGetMaxPcieLinkWidth == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMaxPcieLinkWidth is not found") + return (__nvmlDeviceGetMaxPcieLinkWidth)( + device, maxLinkWidth) + + +cdef nvmlReturn_t _nvmlDeviceGetCurrPcieLinkGeneration(nvmlDevice_t device, unsigned int* currLinkGen) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCurrPcieLinkGeneration + _check_or_init_nvml() + if __nvmlDeviceGetCurrPcieLinkGeneration == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCurrPcieLinkGeneration is not found") + return (__nvmlDeviceGetCurrPcieLinkGeneration)( + device, currLinkGen) + + +cdef nvmlReturn_t _nvmlDeviceGetCurrPcieLinkWidth(nvmlDevice_t device, unsigned int* currLinkWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCurrPcieLinkWidth + _check_or_init_nvml() + if __nvmlDeviceGetCurrPcieLinkWidth == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCurrPcieLinkWidth is not found") + return (__nvmlDeviceGetCurrPcieLinkWidth)( + device, currLinkWidth) + + +cdef nvmlReturn_t _nvmlDeviceGetPcieThroughput(nvmlDevice_t device, nvmlPcieUtilCounter_t counter, unsigned int* value) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPcieThroughput + _check_or_init_nvml() + if __nvmlDeviceGetPcieThroughput == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPcieThroughput is not found") + return (__nvmlDeviceGetPcieThroughput)( + device, counter, value) + + +cdef nvmlReturn_t _nvmlDeviceGetPcieReplayCounter(nvmlDevice_t device, unsigned int* value) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPcieReplayCounter + _check_or_init_nvml() + if __nvmlDeviceGetPcieReplayCounter == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPcieReplayCounter is not found") + return (__nvmlDeviceGetPcieReplayCounter)( + device, value) + + +cdef nvmlReturn_t _nvmlDeviceGetClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetClockInfo + _check_or_init_nvml() + if __nvmlDeviceGetClockInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetClockInfo is not found") + return (__nvmlDeviceGetClockInfo)( + device, type, clock) + + +cdef nvmlReturn_t _nvmlDeviceGetMaxClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMaxClockInfo + _check_or_init_nvml() + if __nvmlDeviceGetMaxClockInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMaxClockInfo is not found") + return (__nvmlDeviceGetMaxClockInfo)( + device, type, clock) + + +cdef nvmlReturn_t _nvmlDeviceGetGpcClkVfOffset(nvmlDevice_t device, int* offset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpcClkVfOffset + _check_or_init_nvml() + if __nvmlDeviceGetGpcClkVfOffset == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpcClkVfOffset is not found") + return (__nvmlDeviceGetGpcClkVfOffset)( + device, offset) + + +cdef nvmlReturn_t _nvmlDeviceGetClock(nvmlDevice_t device, nvmlClockType_t clockType, nvmlClockId_t clockId, unsigned int* clockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetClock + _check_or_init_nvml() + if __nvmlDeviceGetClock == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetClock is not found") + return (__nvmlDeviceGetClock)( + device, clockType, clockId, clockMHz) + + +cdef nvmlReturn_t _nvmlDeviceGetMaxCustomerBoostClock(nvmlDevice_t device, nvmlClockType_t clockType, unsigned int* clockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMaxCustomerBoostClock + _check_or_init_nvml() + if __nvmlDeviceGetMaxCustomerBoostClock == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMaxCustomerBoostClock is not found") + return (__nvmlDeviceGetMaxCustomerBoostClock)( + device, clockType, clockMHz) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedMemoryClocks(nvmlDevice_t device, unsigned int* count, unsigned int* clocksMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedMemoryClocks + _check_or_init_nvml() + if __nvmlDeviceGetSupportedMemoryClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedMemoryClocks is not found") + return (__nvmlDeviceGetSupportedMemoryClocks)( + device, count, clocksMHz) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedGraphicsClocks(nvmlDevice_t device, unsigned int memoryClockMHz, unsigned int* count, unsigned int* clocksMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedGraphicsClocks + _check_or_init_nvml() + if __nvmlDeviceGetSupportedGraphicsClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedGraphicsClocks is not found") + return (__nvmlDeviceGetSupportedGraphicsClocks)( + device, memoryClockMHz, count, clocksMHz) + + +cdef nvmlReturn_t _nvmlDeviceGetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t* isEnabled, nvmlEnableState_t* defaultIsEnabled) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAutoBoostedClocksEnabled + _check_or_init_nvml() + if __nvmlDeviceGetAutoBoostedClocksEnabled == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAutoBoostedClocksEnabled is not found") + return (__nvmlDeviceGetAutoBoostedClocksEnabled)( + device, isEnabled, defaultIsEnabled) + + +cdef nvmlReturn_t _nvmlDeviceGetFanSpeed(nvmlDevice_t device, unsigned int* speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFanSpeed + _check_or_init_nvml() + if __nvmlDeviceGetFanSpeed == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFanSpeed is not found") + return (__nvmlDeviceGetFanSpeed)( + device, speed) + + +cdef nvmlReturn_t _nvmlDeviceGetFanSpeed_v2(nvmlDevice_t device, unsigned int fan, unsigned int* speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFanSpeed_v2 + _check_or_init_nvml() + if __nvmlDeviceGetFanSpeed_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFanSpeed_v2 is not found") + return (__nvmlDeviceGetFanSpeed_v2)( + device, fan, speed) + + +cdef nvmlReturn_t _nvmlDeviceGetFanSpeedRPM(nvmlDevice_t device, nvmlFanSpeedInfo_t* fanSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFanSpeedRPM + _check_or_init_nvml() + if __nvmlDeviceGetFanSpeedRPM == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFanSpeedRPM is not found") + return (__nvmlDeviceGetFanSpeedRPM)( + device, fanSpeed) + + +cdef nvmlReturn_t _nvmlDeviceGetTargetFanSpeed(nvmlDevice_t device, unsigned int fan, unsigned int* targetSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTargetFanSpeed + _check_or_init_nvml() + if __nvmlDeviceGetTargetFanSpeed == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTargetFanSpeed is not found") + return (__nvmlDeviceGetTargetFanSpeed)( + device, fan, targetSpeed) + + +cdef nvmlReturn_t _nvmlDeviceGetMinMaxFanSpeed(nvmlDevice_t device, unsigned int* minSpeed, unsigned int* maxSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMinMaxFanSpeed + _check_or_init_nvml() + if __nvmlDeviceGetMinMaxFanSpeed == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMinMaxFanSpeed is not found") + return (__nvmlDeviceGetMinMaxFanSpeed)( + device, minSpeed, maxSpeed) + + +cdef nvmlReturn_t _nvmlDeviceGetFanControlPolicy_v2(nvmlDevice_t device, unsigned int fan, nvmlFanControlPolicy_t* policy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFanControlPolicy_v2 + _check_or_init_nvml() + if __nvmlDeviceGetFanControlPolicy_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFanControlPolicy_v2 is not found") + return (__nvmlDeviceGetFanControlPolicy_v2)( + device, fan, policy) + + +cdef nvmlReturn_t _nvmlDeviceGetNumFans(nvmlDevice_t device, unsigned int* numFans) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNumFans + _check_or_init_nvml() + if __nvmlDeviceGetNumFans == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNumFans is not found") + return (__nvmlDeviceGetNumFans)( + device, numFans) + + +cdef nvmlReturn_t _nvmlDeviceGetCoolerInfo(nvmlDevice_t device, nvmlCoolerInfo_t* coolerInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCoolerInfo + _check_or_init_nvml() + if __nvmlDeviceGetCoolerInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCoolerInfo is not found") + return (__nvmlDeviceGetCoolerInfo)( + device, coolerInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetTemperatureV(nvmlDevice_t device, nvmlTemperature_t* temperature) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTemperatureV + _check_or_init_nvml() + if __nvmlDeviceGetTemperatureV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTemperatureV is not found") + return (__nvmlDeviceGetTemperatureV)( + device, temperature) + + +cdef nvmlReturn_t _nvmlDeviceGetTemperatureThreshold(nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, unsigned int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTemperatureThreshold + _check_or_init_nvml() + if __nvmlDeviceGetTemperatureThreshold == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTemperatureThreshold is not found") + return (__nvmlDeviceGetTemperatureThreshold)( + device, thresholdType, temp) + + +cdef nvmlReturn_t _nvmlDeviceGetMarginTemperature(nvmlDevice_t device, nvmlMarginTemperature_t* marginTempInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMarginTemperature + _check_or_init_nvml() + if __nvmlDeviceGetMarginTemperature == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMarginTemperature is not found") + return (__nvmlDeviceGetMarginTemperature)( + device, marginTempInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetThermalSettings(nvmlDevice_t device, unsigned int sensorIndex, nvmlGpuThermalSettings_t* pThermalSettings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetThermalSettings + _check_or_init_nvml() + if __nvmlDeviceGetThermalSettings == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetThermalSettings is not found") + return (__nvmlDeviceGetThermalSettings)( + device, sensorIndex, pThermalSettings) + + +cdef nvmlReturn_t _nvmlDeviceGetPerformanceState(nvmlDevice_t device, nvmlPstates_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPerformanceState + _check_or_init_nvml() + if __nvmlDeviceGetPerformanceState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPerformanceState is not found") + return (__nvmlDeviceGetPerformanceState)( + device, pState) + + +cdef nvmlReturn_t _nvmlDeviceGetCurrentClocksEventReasons(nvmlDevice_t device, unsigned long long* clocksEventReasons) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCurrentClocksEventReasons + _check_or_init_nvml() + if __nvmlDeviceGetCurrentClocksEventReasons == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCurrentClocksEventReasons is not found") + return (__nvmlDeviceGetCurrentClocksEventReasons)( + device, clocksEventReasons) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedClocksEventReasons(nvmlDevice_t device, unsigned long long* supportedClocksEventReasons) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedClocksEventReasons + _check_or_init_nvml() + if __nvmlDeviceGetSupportedClocksEventReasons == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedClocksEventReasons is not found") + return (__nvmlDeviceGetSupportedClocksEventReasons)( + device, supportedClocksEventReasons) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerState(nvmlDevice_t device, nvmlPstates_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerState + _check_or_init_nvml() + if __nvmlDeviceGetPowerState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerState is not found") + return (__nvmlDeviceGetPowerState)( + device, pState) + + +cdef nvmlReturn_t _nvmlDeviceGetDynamicPstatesInfo(nvmlDevice_t device, nvmlGpuDynamicPstatesInfo_t* pDynamicPstatesInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDynamicPstatesInfo + _check_or_init_nvml() + if __nvmlDeviceGetDynamicPstatesInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDynamicPstatesInfo is not found") + return (__nvmlDeviceGetDynamicPstatesInfo)( + device, pDynamicPstatesInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetMemClkVfOffset(nvmlDevice_t device, int* offset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemClkVfOffset + _check_or_init_nvml() + if __nvmlDeviceGetMemClkVfOffset == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemClkVfOffset is not found") + return (__nvmlDeviceGetMemClkVfOffset)( + device, offset) + + +cdef nvmlReturn_t _nvmlDeviceGetMinMaxClockOfPState(nvmlDevice_t device, nvmlClockType_t type, nvmlPstates_t pstate, unsigned int* minClockMHz, unsigned int* maxClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMinMaxClockOfPState + _check_or_init_nvml() + if __nvmlDeviceGetMinMaxClockOfPState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMinMaxClockOfPState is not found") + return (__nvmlDeviceGetMinMaxClockOfPState)( + device, type, pstate, minClockMHz, maxClockMHz) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedPerformanceStates(nvmlDevice_t device, nvmlPstates_t* pstates, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedPerformanceStates + _check_or_init_nvml() + if __nvmlDeviceGetSupportedPerformanceStates == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedPerformanceStates is not found") + return (__nvmlDeviceGetSupportedPerformanceStates)( + device, pstates, size) + + +cdef nvmlReturn_t _nvmlDeviceGetGpcClkMinMaxVfOffset(nvmlDevice_t device, int* minOffset, int* maxOffset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpcClkMinMaxVfOffset + _check_or_init_nvml() + if __nvmlDeviceGetGpcClkMinMaxVfOffset == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpcClkMinMaxVfOffset is not found") + return (__nvmlDeviceGetGpcClkMinMaxVfOffset)( + device, minOffset, maxOffset) + + +cdef nvmlReturn_t _nvmlDeviceGetMemClkMinMaxVfOffset(nvmlDevice_t device, int* minOffset, int* maxOffset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemClkMinMaxVfOffset + _check_or_init_nvml() + if __nvmlDeviceGetMemClkMinMaxVfOffset == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemClkMinMaxVfOffset is not found") + return (__nvmlDeviceGetMemClkMinMaxVfOffset)( + device, minOffset, maxOffset) + + +cdef nvmlReturn_t _nvmlDeviceGetClockOffsets(nvmlDevice_t device, nvmlClockOffset_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetClockOffsets + _check_or_init_nvml() + if __nvmlDeviceGetClockOffsets == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetClockOffsets is not found") + return (__nvmlDeviceGetClockOffsets)( + device, info) + + +cdef nvmlReturn_t _nvmlDeviceSetClockOffsets(nvmlDevice_t device, nvmlClockOffset_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetClockOffsets + _check_or_init_nvml() + if __nvmlDeviceSetClockOffsets == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetClockOffsets is not found") + return (__nvmlDeviceSetClockOffsets)( + device, info) + + +cdef nvmlReturn_t _nvmlDeviceGetPerformanceModes(nvmlDevice_t device, nvmlDevicePerfModes_t* perfModes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPerformanceModes + _check_or_init_nvml() + if __nvmlDeviceGetPerformanceModes == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPerformanceModes is not found") + return (__nvmlDeviceGetPerformanceModes)( + device, perfModes) + + +cdef nvmlReturn_t _nvmlDeviceGetCurrentClockFreqs(nvmlDevice_t device, nvmlDeviceCurrentClockFreqs_t* currentClockFreqs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCurrentClockFreqs + _check_or_init_nvml() + if __nvmlDeviceGetCurrentClockFreqs == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCurrentClockFreqs is not found") + return (__nvmlDeviceGetCurrentClockFreqs)( + device, currentClockFreqs) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerManagementLimit(nvmlDevice_t device, unsigned int* limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerManagementLimit + _check_or_init_nvml() + if __nvmlDeviceGetPowerManagementLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerManagementLimit is not found") + return (__nvmlDeviceGetPowerManagementLimit)( + device, limit) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerManagementLimitConstraints(nvmlDevice_t device, unsigned int* minLimit, unsigned int* maxLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerManagementLimitConstraints + _check_or_init_nvml() + if __nvmlDeviceGetPowerManagementLimitConstraints == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerManagementLimitConstraints is not found") + return (__nvmlDeviceGetPowerManagementLimitConstraints)( + device, minLimit, maxLimit) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerManagementDefaultLimit(nvmlDevice_t device, unsigned int* defaultLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerManagementDefaultLimit + _check_or_init_nvml() + if __nvmlDeviceGetPowerManagementDefaultLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerManagementDefaultLimit is not found") + return (__nvmlDeviceGetPowerManagementDefaultLimit)( + device, defaultLimit) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerUsage(nvmlDevice_t device, unsigned int* power) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerUsage + _check_or_init_nvml() + if __nvmlDeviceGetPowerUsage == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerUsage is not found") + return (__nvmlDeviceGetPowerUsage)( + device, power) + + +cdef nvmlReturn_t _nvmlDeviceGetTotalEnergyConsumption(nvmlDevice_t device, unsigned long long* energy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTotalEnergyConsumption + _check_or_init_nvml() + if __nvmlDeviceGetTotalEnergyConsumption == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTotalEnergyConsumption is not found") + return (__nvmlDeviceGetTotalEnergyConsumption)( + device, energy) + + +cdef nvmlReturn_t _nvmlDeviceGetEnforcedPowerLimit(nvmlDevice_t device, unsigned int* limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEnforcedPowerLimit + _check_or_init_nvml() + if __nvmlDeviceGetEnforcedPowerLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEnforcedPowerLimit is not found") + return (__nvmlDeviceGetEnforcedPowerLimit)( + device, limit) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t* current, nvmlGpuOperationMode_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuOperationMode + _check_or_init_nvml() + if __nvmlDeviceGetGpuOperationMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuOperationMode is not found") + return (__nvmlDeviceGetGpuOperationMode)( + device, current, pending) + + +cdef nvmlReturn_t _nvmlDeviceGetMemoryInfo_v2(nvmlDevice_t device, nvmlMemory_v2_t* memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemoryInfo_v2 + _check_or_init_nvml() + if __nvmlDeviceGetMemoryInfo_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemoryInfo_v2 is not found") + return (__nvmlDeviceGetMemoryInfo_v2)( + device, memory) + + +cdef nvmlReturn_t _nvmlDeviceGetComputeMode(nvmlDevice_t device, nvmlComputeMode_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetComputeMode + _check_or_init_nvml() + if __nvmlDeviceGetComputeMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetComputeMode is not found") + return (__nvmlDeviceGetComputeMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceGetCudaComputeCapability(nvmlDevice_t device, int* major, int* minor) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCudaComputeCapability + _check_or_init_nvml() + if __nvmlDeviceGetCudaComputeCapability == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCudaComputeCapability is not found") + return (__nvmlDeviceGetCudaComputeCapability)( + device, major, minor) + + +cdef nvmlReturn_t _nvmlDeviceGetDramEncryptionMode(nvmlDevice_t device, nvmlDramEncryptionInfo_t* current, nvmlDramEncryptionInfo_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDramEncryptionMode + _check_or_init_nvml() + if __nvmlDeviceGetDramEncryptionMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDramEncryptionMode is not found") + return (__nvmlDeviceGetDramEncryptionMode)( + device, current, pending) + + +cdef nvmlReturn_t _nvmlDeviceSetDramEncryptionMode(nvmlDevice_t device, const nvmlDramEncryptionInfo_t* dramEncryption) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetDramEncryptionMode + _check_or_init_nvml() + if __nvmlDeviceSetDramEncryptionMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetDramEncryptionMode is not found") + return (__nvmlDeviceSetDramEncryptionMode)( + device, dramEncryption) + + +cdef nvmlReturn_t _nvmlDeviceGetEccMode(nvmlDevice_t device, nvmlEnableState_t* current, nvmlEnableState_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEccMode + _check_or_init_nvml() + if __nvmlDeviceGetEccMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEccMode is not found") + return (__nvmlDeviceGetEccMode)( + device, current, pending) + + +cdef nvmlReturn_t _nvmlDeviceGetDefaultEccMode(nvmlDevice_t device, nvmlEnableState_t* defaultMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDefaultEccMode + _check_or_init_nvml() + if __nvmlDeviceGetDefaultEccMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDefaultEccMode is not found") + return (__nvmlDeviceGetDefaultEccMode)( + device, defaultMode) + + +cdef nvmlReturn_t _nvmlDeviceGetBoardId(nvmlDevice_t device, unsigned int* boardId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBoardId + _check_or_init_nvml() + if __nvmlDeviceGetBoardId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBoardId is not found") + return (__nvmlDeviceGetBoardId)( + device, boardId) + + +cdef nvmlReturn_t _nvmlDeviceGetMultiGpuBoard(nvmlDevice_t device, unsigned int* multiGpuBool) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMultiGpuBoard + _check_or_init_nvml() + if __nvmlDeviceGetMultiGpuBoard == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMultiGpuBoard is not found") + return (__nvmlDeviceGetMultiGpuBoard)( + device, multiGpuBool) + + +cdef nvmlReturn_t _nvmlDeviceGetTotalEccErrors(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, unsigned long long* eccCounts) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTotalEccErrors + _check_or_init_nvml() + if __nvmlDeviceGetTotalEccErrors == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTotalEccErrors is not found") + return (__nvmlDeviceGetTotalEccErrors)( + device, errorType, counterType, eccCounts) + + +cdef nvmlReturn_t _nvmlDeviceGetMemoryErrorCounter(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, nvmlMemoryLocation_t locationType, unsigned long long* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemoryErrorCounter + _check_or_init_nvml() + if __nvmlDeviceGetMemoryErrorCounter == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemoryErrorCounter is not found") + return (__nvmlDeviceGetMemoryErrorCounter)( + device, errorType, counterType, locationType, count) + + +cdef nvmlReturn_t _nvmlDeviceGetUtilizationRates(nvmlDevice_t device, nvmlUtilization_t* utilization) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetUtilizationRates + _check_or_init_nvml() + if __nvmlDeviceGetUtilizationRates == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetUtilizationRates is not found") + return (__nvmlDeviceGetUtilizationRates)( + device, utilization) + + +cdef nvmlReturn_t _nvmlDeviceGetEncoderUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEncoderUtilization + _check_or_init_nvml() + if __nvmlDeviceGetEncoderUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEncoderUtilization is not found") + return (__nvmlDeviceGetEncoderUtilization)( + device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t _nvmlDeviceGetEncoderCapacity(nvmlDevice_t device, nvmlEncoderType_t encoderQueryType, unsigned int* encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEncoderCapacity + _check_or_init_nvml() + if __nvmlDeviceGetEncoderCapacity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEncoderCapacity is not found") + return (__nvmlDeviceGetEncoderCapacity)( + device, encoderQueryType, encoderCapacity) + + +cdef nvmlReturn_t _nvmlDeviceGetEncoderStats(nvmlDevice_t device, unsigned int* sessionCount, unsigned int* averageFps, unsigned int* averageLatency) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEncoderStats + _check_or_init_nvml() + if __nvmlDeviceGetEncoderStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEncoderStats is not found") + return (__nvmlDeviceGetEncoderStats)( + device, sessionCount, averageFps, averageLatency) + + +cdef nvmlReturn_t _nvmlDeviceGetEncoderSessions(nvmlDevice_t device, unsigned int* sessionCount, nvmlEncoderSessionInfo_t* sessionInfos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEncoderSessions + _check_or_init_nvml() + if __nvmlDeviceGetEncoderSessions == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEncoderSessions is not found") + return (__nvmlDeviceGetEncoderSessions)( + device, sessionCount, sessionInfos) + + +cdef nvmlReturn_t _nvmlDeviceGetDecoderUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDecoderUtilization + _check_or_init_nvml() + if __nvmlDeviceGetDecoderUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDecoderUtilization is not found") + return (__nvmlDeviceGetDecoderUtilization)( + device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t _nvmlDeviceGetJpgUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetJpgUtilization + _check_or_init_nvml() + if __nvmlDeviceGetJpgUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetJpgUtilization is not found") + return (__nvmlDeviceGetJpgUtilization)( + device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t _nvmlDeviceGetOfaUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetOfaUtilization + _check_or_init_nvml() + if __nvmlDeviceGetOfaUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetOfaUtilization is not found") + return (__nvmlDeviceGetOfaUtilization)( + device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t _nvmlDeviceGetFBCStats(nvmlDevice_t device, nvmlFBCStats_t* fbcStats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFBCStats + _check_or_init_nvml() + if __nvmlDeviceGetFBCStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFBCStats is not found") + return (__nvmlDeviceGetFBCStats)( + device, fbcStats) + + +cdef nvmlReturn_t _nvmlDeviceGetFBCSessions(nvmlDevice_t device, unsigned int* sessionCount, nvmlFBCSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFBCSessions + _check_or_init_nvml() + if __nvmlDeviceGetFBCSessions == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFBCSessions is not found") + return (__nvmlDeviceGetFBCSessions)( + device, sessionCount, sessionInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetDriverModel_v2(nvmlDevice_t device, nvmlDriverModel_t* current, nvmlDriverModel_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDriverModel_v2 + _check_or_init_nvml() + if __nvmlDeviceGetDriverModel_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDriverModel_v2 is not found") + return (__nvmlDeviceGetDriverModel_v2)( + device, current, pending) + + +cdef nvmlReturn_t _nvmlDeviceGetVbiosVersion(nvmlDevice_t device, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVbiosVersion + _check_or_init_nvml() + if __nvmlDeviceGetVbiosVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVbiosVersion is not found") + return (__nvmlDeviceGetVbiosVersion)( + device, version, length) + + +cdef nvmlReturn_t _nvmlDeviceGetBridgeChipInfo(nvmlDevice_t device, nvmlBridgeChipHierarchy_t* bridgeHierarchy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBridgeChipInfo + _check_or_init_nvml() + if __nvmlDeviceGetBridgeChipInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBridgeChipInfo is not found") + return (__nvmlDeviceGetBridgeChipInfo)( + device, bridgeHierarchy) + + +cdef nvmlReturn_t _nvmlDeviceGetComputeRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetComputeRunningProcesses_v3 + _check_or_init_nvml() + if __nvmlDeviceGetComputeRunningProcesses_v3 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetComputeRunningProcesses_v3 is not found") + return (__nvmlDeviceGetComputeRunningProcesses_v3)( + device, infoCount, infos) + + +cdef nvmlReturn_t _nvmlDeviceGetGraphicsRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGraphicsRunningProcesses_v3 + _check_or_init_nvml() + if __nvmlDeviceGetGraphicsRunningProcesses_v3 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGraphicsRunningProcesses_v3 is not found") + return (__nvmlDeviceGetGraphicsRunningProcesses_v3)( + device, infoCount, infos) + + +cdef nvmlReturn_t _nvmlDeviceGetMPSComputeRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMPSComputeRunningProcesses_v3 + _check_or_init_nvml() + if __nvmlDeviceGetMPSComputeRunningProcesses_v3 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMPSComputeRunningProcesses_v3 is not found") + return (__nvmlDeviceGetMPSComputeRunningProcesses_v3)( + device, infoCount, infos) + + +cdef nvmlReturn_t _nvmlDeviceGetRunningProcessDetailList(nvmlDevice_t device, nvmlProcessDetailList_t* plist) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRunningProcessDetailList + _check_or_init_nvml() + if __nvmlDeviceGetRunningProcessDetailList == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRunningProcessDetailList is not found") + return (__nvmlDeviceGetRunningProcessDetailList)( + device, plist) + + +cdef nvmlReturn_t _nvmlDeviceOnSameBoard(nvmlDevice_t device1, nvmlDevice_t device2, int* onSameBoard) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceOnSameBoard + _check_or_init_nvml() + if __nvmlDeviceOnSameBoard == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceOnSameBoard is not found") + return (__nvmlDeviceOnSameBoard)( + device1, device2, onSameBoard) + + +cdef nvmlReturn_t _nvmlDeviceGetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t* isRestricted) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAPIRestriction + _check_or_init_nvml() + if __nvmlDeviceGetAPIRestriction == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAPIRestriction is not found") + return (__nvmlDeviceGetAPIRestriction)( + device, apiType, isRestricted) + + +cdef nvmlReturn_t _nvmlDeviceGetSamples(nvmlDevice_t device, nvmlSamplingType_t type, unsigned long long lastSeenTimeStamp, nvmlValueType_t* sampleValType, unsigned int* sampleCount, nvmlSample_t* samples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSamples + _check_or_init_nvml() + if __nvmlDeviceGetSamples == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSamples is not found") + return (__nvmlDeviceGetSamples)( + device, type, lastSeenTimeStamp, sampleValType, sampleCount, samples) + + +cdef nvmlReturn_t _nvmlDeviceGetBAR1MemoryInfo(nvmlDevice_t device, nvmlBAR1Memory_t* bar1Memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBAR1MemoryInfo + _check_or_init_nvml() + if __nvmlDeviceGetBAR1MemoryInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBAR1MemoryInfo is not found") + return (__nvmlDeviceGetBAR1MemoryInfo)( + device, bar1Memory) + + +cdef nvmlReturn_t _nvmlDeviceGetIrqNum(nvmlDevice_t device, unsigned int* irqNum) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetIrqNum + _check_or_init_nvml() + if __nvmlDeviceGetIrqNum == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetIrqNum is not found") + return (__nvmlDeviceGetIrqNum)( + device, irqNum) + + +cdef nvmlReturn_t _nvmlDeviceGetNumGpuCores(nvmlDevice_t device, unsigned int* numCores) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNumGpuCores + _check_or_init_nvml() + if __nvmlDeviceGetNumGpuCores == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNumGpuCores is not found") + return (__nvmlDeviceGetNumGpuCores)( + device, numCores) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerSource(nvmlDevice_t device, nvmlPowerSource_t* powerSource) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerSource + _check_or_init_nvml() + if __nvmlDeviceGetPowerSource == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerSource is not found") + return (__nvmlDeviceGetPowerSource)( + device, powerSource) + + +cdef nvmlReturn_t _nvmlDeviceGetMemoryBusWidth(nvmlDevice_t device, unsigned int* busWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemoryBusWidth + _check_or_init_nvml() + if __nvmlDeviceGetMemoryBusWidth == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemoryBusWidth is not found") + return (__nvmlDeviceGetMemoryBusWidth)( + device, busWidth) + + +cdef nvmlReturn_t _nvmlDeviceGetPcieLinkMaxSpeed(nvmlDevice_t device, unsigned int* maxSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPcieLinkMaxSpeed + _check_or_init_nvml() + if __nvmlDeviceGetPcieLinkMaxSpeed == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPcieLinkMaxSpeed is not found") + return (__nvmlDeviceGetPcieLinkMaxSpeed)( + device, maxSpeed) + + +cdef nvmlReturn_t _nvmlDeviceGetPcieSpeed(nvmlDevice_t device, unsigned int* pcieSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPcieSpeed + _check_or_init_nvml() + if __nvmlDeviceGetPcieSpeed == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPcieSpeed is not found") + return (__nvmlDeviceGetPcieSpeed)( + device, pcieSpeed) + + +cdef nvmlReturn_t _nvmlDeviceGetAdaptiveClockInfoStatus(nvmlDevice_t device, unsigned int* adaptiveClockStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAdaptiveClockInfoStatus + _check_or_init_nvml() + if __nvmlDeviceGetAdaptiveClockInfoStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAdaptiveClockInfoStatus is not found") + return (__nvmlDeviceGetAdaptiveClockInfoStatus)( + device, adaptiveClockStatus) + + +cdef nvmlReturn_t _nvmlDeviceGetBusType(nvmlDevice_t device, nvmlBusType_t* type) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBusType + _check_or_init_nvml() + if __nvmlDeviceGetBusType == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBusType is not found") + return (__nvmlDeviceGetBusType)( + device, type) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuFabricInfoV(nvmlDevice_t device, nvmlGpuFabricInfoV_t* gpuFabricInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuFabricInfoV + _check_or_init_nvml() + if __nvmlDeviceGetGpuFabricInfoV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuFabricInfoV is not found") + return (__nvmlDeviceGetGpuFabricInfoV)( + device, gpuFabricInfo) + + +cdef nvmlReturn_t _nvmlSystemGetConfComputeCapabilities(nvmlConfComputeSystemCaps_t* capabilities) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetConfComputeCapabilities + _check_or_init_nvml() + if __nvmlSystemGetConfComputeCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetConfComputeCapabilities is not found") + return (__nvmlSystemGetConfComputeCapabilities)( + capabilities) + + +cdef nvmlReturn_t _nvmlSystemGetConfComputeState(nvmlConfComputeSystemState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetConfComputeState + _check_or_init_nvml() + if __nvmlSystemGetConfComputeState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetConfComputeState is not found") + return (__nvmlSystemGetConfComputeState)( + state) + + +cdef nvmlReturn_t _nvmlDeviceGetConfComputeMemSizeInfo(nvmlDevice_t device, nvmlConfComputeMemSizeInfo_t* memInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetConfComputeMemSizeInfo + _check_or_init_nvml() + if __nvmlDeviceGetConfComputeMemSizeInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetConfComputeMemSizeInfo is not found") + return (__nvmlDeviceGetConfComputeMemSizeInfo)( + device, memInfo) + + +cdef nvmlReturn_t _nvmlSystemGetConfComputeGpusReadyState(unsigned int* isAcceptingWork) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetConfComputeGpusReadyState + _check_or_init_nvml() + if __nvmlSystemGetConfComputeGpusReadyState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetConfComputeGpusReadyState is not found") + return (__nvmlSystemGetConfComputeGpusReadyState)( + isAcceptingWork) + + +cdef nvmlReturn_t _nvmlDeviceGetConfComputeProtectedMemoryUsage(nvmlDevice_t device, nvmlMemory_t* memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetConfComputeProtectedMemoryUsage + _check_or_init_nvml() + if __nvmlDeviceGetConfComputeProtectedMemoryUsage == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetConfComputeProtectedMemoryUsage is not found") + return (__nvmlDeviceGetConfComputeProtectedMemoryUsage)( + device, memory) + + +cdef nvmlReturn_t _nvmlDeviceGetConfComputeGpuCertificate(nvmlDevice_t device, nvmlConfComputeGpuCertificate_t* gpuCert) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetConfComputeGpuCertificate + _check_or_init_nvml() + if __nvmlDeviceGetConfComputeGpuCertificate == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetConfComputeGpuCertificate is not found") + return (__nvmlDeviceGetConfComputeGpuCertificate)( + device, gpuCert) + + +cdef nvmlReturn_t _nvmlDeviceGetConfComputeGpuAttestationReport(nvmlDevice_t device, nvmlConfComputeGpuAttestationReport_t* gpuAtstReport) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetConfComputeGpuAttestationReport + _check_or_init_nvml() + if __nvmlDeviceGetConfComputeGpuAttestationReport == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetConfComputeGpuAttestationReport is not found") + return (__nvmlDeviceGetConfComputeGpuAttestationReport)( + device, gpuAtstReport) + + +cdef nvmlReturn_t _nvmlSystemGetConfComputeKeyRotationThresholdInfo(nvmlConfComputeGetKeyRotationThresholdInfo_t* pKeyRotationThrInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetConfComputeKeyRotationThresholdInfo + _check_or_init_nvml() + if __nvmlSystemGetConfComputeKeyRotationThresholdInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetConfComputeKeyRotationThresholdInfo is not found") + return (__nvmlSystemGetConfComputeKeyRotationThresholdInfo)( + pKeyRotationThrInfo) + + +cdef nvmlReturn_t _nvmlDeviceSetConfComputeUnprotectedMemSize(nvmlDevice_t device, unsigned long long sizeKiB) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetConfComputeUnprotectedMemSize + _check_or_init_nvml() + if __nvmlDeviceSetConfComputeUnprotectedMemSize == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetConfComputeUnprotectedMemSize is not found") + return (__nvmlDeviceSetConfComputeUnprotectedMemSize)( + device, sizeKiB) + + +cdef nvmlReturn_t _nvmlSystemSetConfComputeGpusReadyState(unsigned int isAcceptingWork) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemSetConfComputeGpusReadyState + _check_or_init_nvml() + if __nvmlSystemSetConfComputeGpusReadyState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemSetConfComputeGpusReadyState is not found") + return (__nvmlSystemSetConfComputeGpusReadyState)( + isAcceptingWork) + + +cdef nvmlReturn_t _nvmlSystemSetConfComputeKeyRotationThresholdInfo(nvmlConfComputeSetKeyRotationThresholdInfo_t* pKeyRotationThrInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemSetConfComputeKeyRotationThresholdInfo + _check_or_init_nvml() + if __nvmlSystemSetConfComputeKeyRotationThresholdInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemSetConfComputeKeyRotationThresholdInfo is not found") + return (__nvmlSystemSetConfComputeKeyRotationThresholdInfo)( + pKeyRotationThrInfo) + + +cdef nvmlReturn_t _nvmlSystemGetConfComputeSettings(nvmlSystemConfComputeSettings_t* settings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetConfComputeSettings + _check_or_init_nvml() + if __nvmlSystemGetConfComputeSettings == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetConfComputeSettings is not found") + return (__nvmlSystemGetConfComputeSettings)( + settings) + + +cdef nvmlReturn_t _nvmlDeviceGetGspFirmwareVersion(nvmlDevice_t device, char* version) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGspFirmwareVersion + _check_or_init_nvml() + if __nvmlDeviceGetGspFirmwareVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGspFirmwareVersion is not found") + return (__nvmlDeviceGetGspFirmwareVersion)( + device, version) + + +cdef nvmlReturn_t _nvmlDeviceGetGspFirmwareMode(nvmlDevice_t device, unsigned int* isEnabled, unsigned int* defaultMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGspFirmwareMode + _check_or_init_nvml() + if __nvmlDeviceGetGspFirmwareMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGspFirmwareMode is not found") + return (__nvmlDeviceGetGspFirmwareMode)( + device, isEnabled, defaultMode) + + +cdef nvmlReturn_t _nvmlDeviceGetSramEccErrorStatus(nvmlDevice_t device, nvmlEccSramErrorStatus_t* status) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSramEccErrorStatus + _check_or_init_nvml() + if __nvmlDeviceGetSramEccErrorStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSramEccErrorStatus is not found") + return (__nvmlDeviceGetSramEccErrorStatus)( + device, status) + + +cdef nvmlReturn_t _nvmlDeviceGetAccountingMode(nvmlDevice_t device, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAccountingMode + _check_or_init_nvml() + if __nvmlDeviceGetAccountingMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAccountingMode is not found") + return (__nvmlDeviceGetAccountingMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceGetAccountingStats(nvmlDevice_t device, unsigned int pid, nvmlAccountingStats_t* stats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAccountingStats + _check_or_init_nvml() + if __nvmlDeviceGetAccountingStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAccountingStats is not found") + return (__nvmlDeviceGetAccountingStats)( + device, pid, stats) + + +cdef nvmlReturn_t _nvmlDeviceGetAccountingPids(nvmlDevice_t device, unsigned int* count, unsigned int* pids) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAccountingPids + _check_or_init_nvml() + if __nvmlDeviceGetAccountingPids == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAccountingPids is not found") + return (__nvmlDeviceGetAccountingPids)( + device, count, pids) + + +cdef nvmlReturn_t _nvmlDeviceGetAccountingBufferSize(nvmlDevice_t device, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAccountingBufferSize + _check_or_init_nvml() + if __nvmlDeviceGetAccountingBufferSize == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAccountingBufferSize is not found") + return (__nvmlDeviceGetAccountingBufferSize)( + device, bufferSize) + + +cdef nvmlReturn_t _nvmlDeviceGetRetiredPages(nvmlDevice_t device, nvmlPageRetirementCause_t cause, unsigned int* pageCount, unsigned long long* addresses) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRetiredPages + _check_or_init_nvml() + if __nvmlDeviceGetRetiredPages == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRetiredPages is not found") + return (__nvmlDeviceGetRetiredPages)( + device, cause, pageCount, addresses) + + +cdef nvmlReturn_t _nvmlDeviceGetRetiredPages_v2(nvmlDevice_t device, nvmlPageRetirementCause_t cause, unsigned int* pageCount, unsigned long long* addresses, unsigned long long* timestamps) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRetiredPages_v2 + _check_or_init_nvml() + if __nvmlDeviceGetRetiredPages_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRetiredPages_v2 is not found") + return (__nvmlDeviceGetRetiredPages_v2)( + device, cause, pageCount, addresses, timestamps) + + +cdef nvmlReturn_t _nvmlDeviceGetRetiredPagesPendingStatus(nvmlDevice_t device, nvmlEnableState_t* isPending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRetiredPagesPendingStatus + _check_or_init_nvml() + if __nvmlDeviceGetRetiredPagesPendingStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRetiredPagesPendingStatus is not found") + return (__nvmlDeviceGetRetiredPagesPendingStatus)( + device, isPending) + + +cdef nvmlReturn_t _nvmlDeviceGetRemappedRows(nvmlDevice_t device, unsigned int* corrRows, unsigned int* uncRows, unsigned int* isPending, unsigned int* failureOccurred) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRemappedRows + _check_or_init_nvml() + if __nvmlDeviceGetRemappedRows == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRemappedRows is not found") + return (__nvmlDeviceGetRemappedRows)( + device, corrRows, uncRows, isPending, failureOccurred) + + +cdef nvmlReturn_t _nvmlDeviceGetRowRemapperHistogram(nvmlDevice_t device, nvmlRowRemapperHistogramValues_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRowRemapperHistogram + _check_or_init_nvml() + if __nvmlDeviceGetRowRemapperHistogram == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRowRemapperHistogram is not found") + return (__nvmlDeviceGetRowRemapperHistogram)( + device, values) + + +cdef nvmlReturn_t _nvmlDeviceGetArchitecture(nvmlDevice_t device, nvmlDeviceArchitecture_t* arch) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetArchitecture + _check_or_init_nvml() + if __nvmlDeviceGetArchitecture == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetArchitecture is not found") + return (__nvmlDeviceGetArchitecture)( + device, arch) + + +cdef nvmlReturn_t _nvmlDeviceGetClkMonStatus(nvmlDevice_t device, nvmlClkMonStatus_t* status) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetClkMonStatus + _check_or_init_nvml() + if __nvmlDeviceGetClkMonStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetClkMonStatus is not found") + return (__nvmlDeviceGetClkMonStatus)( + device, status) + + +cdef nvmlReturn_t _nvmlDeviceGetProcessUtilization(nvmlDevice_t device, nvmlProcessUtilizationSample_t* utilization, unsigned int* processSamplesCount, unsigned long long lastSeenTimeStamp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetProcessUtilization + _check_or_init_nvml() + if __nvmlDeviceGetProcessUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetProcessUtilization is not found") + return (__nvmlDeviceGetProcessUtilization)( + device, utilization, processSamplesCount, lastSeenTimeStamp) + + +cdef nvmlReturn_t _nvmlDeviceGetProcessesUtilizationInfo(nvmlDevice_t device, nvmlProcessesUtilizationInfo_t* procesesUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetProcessesUtilizationInfo + _check_or_init_nvml() + if __nvmlDeviceGetProcessesUtilizationInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetProcessesUtilizationInfo is not found") + return (__nvmlDeviceGetProcessesUtilizationInfo)( + device, procesesUtilInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetPlatformInfo(nvmlDevice_t device, nvmlPlatformInfo_t* platformInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPlatformInfo + _check_or_init_nvml() + if __nvmlDeviceGetPlatformInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPlatformInfo is not found") + return (__nvmlDeviceGetPlatformInfo)( + device, platformInfo) + + +cdef nvmlReturn_t _nvmlUnitSetLedState(nvmlUnit_t unit, nvmlLedColor_t color) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitSetLedState + _check_or_init_nvml() + if __nvmlUnitSetLedState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitSetLedState is not found") + return (__nvmlUnitSetLedState)( + unit, color) + + +cdef nvmlReturn_t _nvmlDeviceSetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetPersistenceMode + _check_or_init_nvml() + if __nvmlDeviceSetPersistenceMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetPersistenceMode is not found") + return (__nvmlDeviceSetPersistenceMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceSetComputeMode(nvmlDevice_t device, nvmlComputeMode_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetComputeMode + _check_or_init_nvml() + if __nvmlDeviceSetComputeMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetComputeMode is not found") + return (__nvmlDeviceSetComputeMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceSetEccMode(nvmlDevice_t device, nvmlEnableState_t ecc) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetEccMode + _check_or_init_nvml() + if __nvmlDeviceSetEccMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetEccMode is not found") + return (__nvmlDeviceSetEccMode)( + device, ecc) + + +cdef nvmlReturn_t _nvmlDeviceClearEccErrorCounts(nvmlDevice_t device, nvmlEccCounterType_t counterType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceClearEccErrorCounts + _check_or_init_nvml() + if __nvmlDeviceClearEccErrorCounts == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceClearEccErrorCounts is not found") + return (__nvmlDeviceClearEccErrorCounts)( + device, counterType) + + +cdef nvmlReturn_t _nvmlDeviceSetDriverModel(nvmlDevice_t device, nvmlDriverModel_t driverModel, unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetDriverModel + _check_or_init_nvml() + if __nvmlDeviceSetDriverModel == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetDriverModel is not found") + return (__nvmlDeviceSetDriverModel)( + device, driverModel, flags) + + +cdef nvmlReturn_t _nvmlDeviceSetGpuLockedClocks(nvmlDevice_t device, unsigned int minGpuClockMHz, unsigned int maxGpuClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetGpuLockedClocks + _check_or_init_nvml() + if __nvmlDeviceSetGpuLockedClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetGpuLockedClocks is not found") + return (__nvmlDeviceSetGpuLockedClocks)( + device, minGpuClockMHz, maxGpuClockMHz) + + +cdef nvmlReturn_t _nvmlDeviceResetGpuLockedClocks(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceResetGpuLockedClocks + _check_or_init_nvml() + if __nvmlDeviceResetGpuLockedClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceResetGpuLockedClocks is not found") + return (__nvmlDeviceResetGpuLockedClocks)( + device) + + +cdef nvmlReturn_t _nvmlDeviceSetMemoryLockedClocks(nvmlDevice_t device, unsigned int minMemClockMHz, unsigned int maxMemClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetMemoryLockedClocks + _check_or_init_nvml() + if __nvmlDeviceSetMemoryLockedClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetMemoryLockedClocks is not found") + return (__nvmlDeviceSetMemoryLockedClocks)( + device, minMemClockMHz, maxMemClockMHz) + + +cdef nvmlReturn_t _nvmlDeviceResetMemoryLockedClocks(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceResetMemoryLockedClocks + _check_or_init_nvml() + if __nvmlDeviceResetMemoryLockedClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceResetMemoryLockedClocks is not found") + return (__nvmlDeviceResetMemoryLockedClocks)( + device) + + +cdef nvmlReturn_t _nvmlDeviceSetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetAutoBoostedClocksEnabled + _check_or_init_nvml() + if __nvmlDeviceSetAutoBoostedClocksEnabled == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetAutoBoostedClocksEnabled is not found") + return (__nvmlDeviceSetAutoBoostedClocksEnabled)( + device, enabled) + + +cdef nvmlReturn_t _nvmlDeviceSetDefaultAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled, unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetDefaultAutoBoostedClocksEnabled + _check_or_init_nvml() + if __nvmlDeviceSetDefaultAutoBoostedClocksEnabled == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetDefaultAutoBoostedClocksEnabled is not found") + return (__nvmlDeviceSetDefaultAutoBoostedClocksEnabled)( + device, enabled, flags) + + +cdef nvmlReturn_t _nvmlDeviceSetDefaultFanSpeed_v2(nvmlDevice_t device, unsigned int fan) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetDefaultFanSpeed_v2 + _check_or_init_nvml() + if __nvmlDeviceSetDefaultFanSpeed_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetDefaultFanSpeed_v2 is not found") + return (__nvmlDeviceSetDefaultFanSpeed_v2)( + device, fan) + + +cdef nvmlReturn_t _nvmlDeviceSetFanControlPolicy(nvmlDevice_t device, unsigned int fan, nvmlFanControlPolicy_t policy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetFanControlPolicy + _check_or_init_nvml() + if __nvmlDeviceSetFanControlPolicy == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetFanControlPolicy is not found") + return (__nvmlDeviceSetFanControlPolicy)( + device, fan, policy) + + +cdef nvmlReturn_t _nvmlDeviceSetTemperatureThreshold(nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetTemperatureThreshold + _check_or_init_nvml() + if __nvmlDeviceSetTemperatureThreshold == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetTemperatureThreshold is not found") + return (__nvmlDeviceSetTemperatureThreshold)( + device, thresholdType, temp) + + +cdef nvmlReturn_t _nvmlDeviceSetPowerManagementLimit(nvmlDevice_t device, unsigned int limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetPowerManagementLimit + _check_or_init_nvml() + if __nvmlDeviceSetPowerManagementLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetPowerManagementLimit is not found") + return (__nvmlDeviceSetPowerManagementLimit)( + device, limit) + + +cdef nvmlReturn_t _nvmlDeviceSetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetGpuOperationMode + _check_or_init_nvml() + if __nvmlDeviceSetGpuOperationMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetGpuOperationMode is not found") + return (__nvmlDeviceSetGpuOperationMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceSetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t isRestricted) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetAPIRestriction + _check_or_init_nvml() + if __nvmlDeviceSetAPIRestriction == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetAPIRestriction is not found") + return (__nvmlDeviceSetAPIRestriction)( + device, apiType, isRestricted) + + +cdef nvmlReturn_t _nvmlDeviceSetFanSpeed_v2(nvmlDevice_t device, unsigned int fan, unsigned int speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetFanSpeed_v2 + _check_or_init_nvml() + if __nvmlDeviceSetFanSpeed_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetFanSpeed_v2 is not found") + return (__nvmlDeviceSetFanSpeed_v2)( + device, fan, speed) + + +cdef nvmlReturn_t _nvmlDeviceSetAccountingMode(nvmlDevice_t device, nvmlEnableState_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetAccountingMode + _check_or_init_nvml() + if __nvmlDeviceSetAccountingMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetAccountingMode is not found") + return (__nvmlDeviceSetAccountingMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceClearAccountingPids(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceClearAccountingPids + _check_or_init_nvml() + if __nvmlDeviceClearAccountingPids == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceClearAccountingPids is not found") + return (__nvmlDeviceClearAccountingPids)( + device) + + +cdef nvmlReturn_t _nvmlDeviceSetPowerManagementLimit_v2(nvmlDevice_t device, nvmlPowerValue_v2_t* powerValue) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetPowerManagementLimit_v2 + _check_or_init_nvml() + if __nvmlDeviceSetPowerManagementLimit_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetPowerManagementLimit_v2 is not found") + return (__nvmlDeviceSetPowerManagementLimit_v2)( + device, powerValue) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkState(nvmlDevice_t device, unsigned int link, nvmlEnableState_t* isActive) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkState + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkState is not found") + return (__nvmlDeviceGetNvLinkState)( + device, link, isActive) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkVersion(nvmlDevice_t device, unsigned int link, unsigned int* version) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkVersion + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkVersion is not found") + return (__nvmlDeviceGetNvLinkVersion)( + device, link, version) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkCapability(nvmlDevice_t device, unsigned int link, nvmlNvLinkCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkCapability + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkCapability == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkCapability is not found") + return (__nvmlDeviceGetNvLinkCapability)( + device, link, capability, capResult) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkRemotePciInfo_v2(nvmlDevice_t device, unsigned int link, nvmlPciInfo_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkRemotePciInfo_v2 + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkRemotePciInfo_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkRemotePciInfo_v2 is not found") + return (__nvmlDeviceGetNvLinkRemotePciInfo_v2)( + device, link, pci) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkErrorCounter(nvmlDevice_t device, unsigned int link, nvmlNvLinkErrorCounter_t counter, unsigned long long* counterValue) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkErrorCounter + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkErrorCounter == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkErrorCounter is not found") + return (__nvmlDeviceGetNvLinkErrorCounter)( + device, link, counter, counterValue) + + +cdef nvmlReturn_t _nvmlDeviceResetNvLinkErrorCounters(nvmlDevice_t device, unsigned int link) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceResetNvLinkErrorCounters + _check_or_init_nvml() + if __nvmlDeviceResetNvLinkErrorCounters == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceResetNvLinkErrorCounters is not found") + return (__nvmlDeviceResetNvLinkErrorCounters)( + device, link) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkRemoteDeviceType(nvmlDevice_t device, unsigned int link, nvmlIntNvLinkDeviceType_t* pNvLinkDeviceType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkRemoteDeviceType + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkRemoteDeviceType == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkRemoteDeviceType is not found") + return (__nvmlDeviceGetNvLinkRemoteDeviceType)( + device, link, pNvLinkDeviceType) + + +cdef nvmlReturn_t _nvmlDeviceSetNvLinkDeviceLowPowerThreshold(nvmlDevice_t device, nvmlNvLinkPowerThres_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetNvLinkDeviceLowPowerThreshold + _check_or_init_nvml() + if __nvmlDeviceSetNvLinkDeviceLowPowerThreshold == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetNvLinkDeviceLowPowerThreshold is not found") + return (__nvmlDeviceSetNvLinkDeviceLowPowerThreshold)( + device, info) + + +cdef nvmlReturn_t _nvmlSystemSetNvlinkBwMode(unsigned int nvlinkBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemSetNvlinkBwMode + _check_or_init_nvml() + if __nvmlSystemSetNvlinkBwMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemSetNvlinkBwMode is not found") + return (__nvmlSystemSetNvlinkBwMode)( + nvlinkBwMode) + + +cdef nvmlReturn_t _nvmlSystemGetNvlinkBwMode(unsigned int* nvlinkBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetNvlinkBwMode + _check_or_init_nvml() + if __nvmlSystemGetNvlinkBwMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetNvlinkBwMode is not found") + return (__nvmlSystemGetNvlinkBwMode)( + nvlinkBwMode) + + +cdef nvmlReturn_t _nvmlDeviceGetNvlinkSupportedBwModes(nvmlDevice_t device, nvmlNvlinkSupportedBwModes_t* supportedBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvlinkSupportedBwModes + _check_or_init_nvml() + if __nvmlDeviceGetNvlinkSupportedBwModes == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvlinkSupportedBwModes is not found") + return (__nvmlDeviceGetNvlinkSupportedBwModes)( + device, supportedBwMode) + + +cdef nvmlReturn_t _nvmlDeviceGetNvlinkBwMode(nvmlDevice_t device, nvmlNvlinkGetBwMode_t* getBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvlinkBwMode + _check_or_init_nvml() + if __nvmlDeviceGetNvlinkBwMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvlinkBwMode is not found") + return (__nvmlDeviceGetNvlinkBwMode)( + device, getBwMode) + + +cdef nvmlReturn_t _nvmlDeviceSetNvlinkBwMode(nvmlDevice_t device, nvmlNvlinkSetBwMode_t* setBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetNvlinkBwMode + _check_or_init_nvml() + if __nvmlDeviceSetNvlinkBwMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetNvlinkBwMode is not found") + return (__nvmlDeviceSetNvlinkBwMode)( + device, setBwMode) + + +cdef nvmlReturn_t _nvmlEventSetCreate(nvmlEventSet_t* set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlEventSetCreate + _check_or_init_nvml() + if __nvmlEventSetCreate == NULL: + with gil: + raise FunctionNotFoundError("function nvmlEventSetCreate is not found") + return (__nvmlEventSetCreate)( + set) + + +cdef nvmlReturn_t _nvmlDeviceRegisterEvents(nvmlDevice_t device, unsigned long long eventTypes, nvmlEventSet_t set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceRegisterEvents + _check_or_init_nvml() + if __nvmlDeviceRegisterEvents == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceRegisterEvents is not found") + return (__nvmlDeviceRegisterEvents)( + device, eventTypes, set) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedEventTypes(nvmlDevice_t device, unsigned long long* eventTypes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedEventTypes + _check_or_init_nvml() + if __nvmlDeviceGetSupportedEventTypes == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedEventTypes is not found") + return (__nvmlDeviceGetSupportedEventTypes)( + device, eventTypes) + + +cdef nvmlReturn_t _nvmlEventSetWait_v2(nvmlEventSet_t set, nvmlEventData_t* data, unsigned int timeoutms) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlEventSetWait_v2 + _check_or_init_nvml() + if __nvmlEventSetWait_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlEventSetWait_v2 is not found") + return (__nvmlEventSetWait_v2)( + set, data, timeoutms) + + +cdef nvmlReturn_t _nvmlEventSetFree(nvmlEventSet_t set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlEventSetFree + _check_or_init_nvml() + if __nvmlEventSetFree == NULL: + with gil: + raise FunctionNotFoundError("function nvmlEventSetFree is not found") + return (__nvmlEventSetFree)( + set) + + +cdef nvmlReturn_t _nvmlSystemEventSetCreate(nvmlSystemEventSetCreateRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemEventSetCreate + _check_or_init_nvml() + if __nvmlSystemEventSetCreate == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemEventSetCreate is not found") + return (__nvmlSystemEventSetCreate)( + request) + + +cdef nvmlReturn_t _nvmlSystemEventSetFree(nvmlSystemEventSetFreeRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemEventSetFree + _check_or_init_nvml() + if __nvmlSystemEventSetFree == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemEventSetFree is not found") + return (__nvmlSystemEventSetFree)( + request) + + +cdef nvmlReturn_t _nvmlSystemRegisterEvents(nvmlSystemRegisterEventRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemRegisterEvents + _check_or_init_nvml() + if __nvmlSystemRegisterEvents == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemRegisterEvents is not found") + return (__nvmlSystemRegisterEvents)( + request) + + +cdef nvmlReturn_t _nvmlSystemEventSetWait(nvmlSystemEventSetWaitRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemEventSetWait + _check_or_init_nvml() + if __nvmlSystemEventSetWait == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemEventSetWait is not found") + return (__nvmlSystemEventSetWait)( + request) + + +cdef nvmlReturn_t _nvmlDeviceModifyDrainState(nvmlPciInfo_t* pciInfo, nvmlEnableState_t newState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceModifyDrainState + _check_or_init_nvml() + if __nvmlDeviceModifyDrainState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceModifyDrainState is not found") + return (__nvmlDeviceModifyDrainState)( + pciInfo, newState) + + +cdef nvmlReturn_t _nvmlDeviceQueryDrainState(nvmlPciInfo_t* pciInfo, nvmlEnableState_t* currentState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceQueryDrainState + _check_or_init_nvml() + if __nvmlDeviceQueryDrainState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceQueryDrainState is not found") + return (__nvmlDeviceQueryDrainState)( + pciInfo, currentState) + + +cdef nvmlReturn_t _nvmlDeviceRemoveGpu_v2(nvmlPciInfo_t* pciInfo, nvmlDetachGpuState_t gpuState, nvmlPcieLinkState_t linkState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceRemoveGpu_v2 + _check_or_init_nvml() + if __nvmlDeviceRemoveGpu_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceRemoveGpu_v2 is not found") + return (__nvmlDeviceRemoveGpu_v2)( + pciInfo, gpuState, linkState) + + +cdef nvmlReturn_t _nvmlDeviceDiscoverGpus(nvmlPciInfo_t* pciInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceDiscoverGpus + _check_or_init_nvml() + if __nvmlDeviceDiscoverGpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceDiscoverGpus is not found") + return (__nvmlDeviceDiscoverGpus)( + pciInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetFieldValues(nvmlDevice_t device, int valuesCount, nvmlFieldValue_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFieldValues + _check_or_init_nvml() + if __nvmlDeviceGetFieldValues == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFieldValues is not found") + return (__nvmlDeviceGetFieldValues)( + device, valuesCount, values) + + +cdef nvmlReturn_t _nvmlDeviceClearFieldValues(nvmlDevice_t device, int valuesCount, nvmlFieldValue_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceClearFieldValues + _check_or_init_nvml() + if __nvmlDeviceClearFieldValues == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceClearFieldValues is not found") + return (__nvmlDeviceClearFieldValues)( + device, valuesCount, values) + + +cdef nvmlReturn_t _nvmlDeviceGetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t* pVirtualMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVirtualizationMode + _check_or_init_nvml() + if __nvmlDeviceGetVirtualizationMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVirtualizationMode is not found") + return (__nvmlDeviceGetVirtualizationMode)( + device, pVirtualMode) + + +cdef nvmlReturn_t _nvmlDeviceGetHostVgpuMode(nvmlDevice_t device, nvmlHostVgpuMode_t* pHostVgpuMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHostVgpuMode + _check_or_init_nvml() + if __nvmlDeviceGetHostVgpuMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHostVgpuMode is not found") + return (__nvmlDeviceGetHostVgpuMode)( + device, pHostVgpuMode) + + +cdef nvmlReturn_t _nvmlDeviceSetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t virtualMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetVirtualizationMode + _check_or_init_nvml() + if __nvmlDeviceSetVirtualizationMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetVirtualizationMode is not found") + return (__nvmlDeviceSetVirtualizationMode)( + device, virtualMode) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuHeterogeneousMode(nvmlDevice_t device, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuHeterogeneousMode + _check_or_init_nvml() + if __nvmlDeviceGetVgpuHeterogeneousMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuHeterogeneousMode is not found") + return (__nvmlDeviceGetVgpuHeterogeneousMode)( + device, pHeterogeneousMode) + + +cdef nvmlReturn_t _nvmlDeviceSetVgpuHeterogeneousMode(nvmlDevice_t device, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetVgpuHeterogeneousMode + _check_or_init_nvml() + if __nvmlDeviceSetVgpuHeterogeneousMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetVgpuHeterogeneousMode is not found") + return (__nvmlDeviceSetVgpuHeterogeneousMode)( + device, pHeterogeneousMode) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetPlacementId(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuPlacementId_t* pPlacement) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetPlacementId + _check_or_init_nvml() + if __nvmlVgpuInstanceGetPlacementId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetPlacementId is not found") + return (__nvmlVgpuInstanceGetPlacementId)( + vgpuInstance, pPlacement) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuTypeSupportedPlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuTypeSupportedPlacements + _check_or_init_nvml() + if __nvmlDeviceGetVgpuTypeSupportedPlacements == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuTypeSupportedPlacements is not found") + return (__nvmlDeviceGetVgpuTypeSupportedPlacements)( + device, vgpuTypeId, pPlacementList) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuTypeCreatablePlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuTypeCreatablePlacements + _check_or_init_nvml() + if __nvmlDeviceGetVgpuTypeCreatablePlacements == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuTypeCreatablePlacements is not found") + return (__nvmlDeviceGetVgpuTypeCreatablePlacements)( + device, vgpuTypeId, pPlacementList) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetGspHeapSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* gspHeapSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetGspHeapSize + _check_or_init_nvml() + if __nvmlVgpuTypeGetGspHeapSize == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetGspHeapSize is not found") + return (__nvmlVgpuTypeGetGspHeapSize)( + vgpuTypeId, gspHeapSize) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetFbReservation(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbReservation) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetFbReservation + _check_or_init_nvml() + if __nvmlVgpuTypeGetFbReservation == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetFbReservation is not found") + return (__nvmlVgpuTypeGetFbReservation)( + vgpuTypeId, fbReservation) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetRuntimeStateSize(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuRuntimeState_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetRuntimeStateSize + _check_or_init_nvml() + if __nvmlVgpuInstanceGetRuntimeStateSize == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetRuntimeStateSize is not found") + return (__nvmlVgpuInstanceGetRuntimeStateSize)( + vgpuInstance, pState) + + +cdef nvmlReturn_t _nvmlDeviceSetVgpuCapabilities(nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, nvmlEnableState_t state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetVgpuCapabilities + _check_or_init_nvml() + if __nvmlDeviceSetVgpuCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetVgpuCapabilities is not found") + return (__nvmlDeviceSetVgpuCapabilities)( + device, capability, state) + + +cdef nvmlReturn_t _nvmlDeviceGetGridLicensableFeatures_v4(nvmlDevice_t device, nvmlGridLicensableFeatures_t* pGridLicensableFeatures) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGridLicensableFeatures_v4 + _check_or_init_nvml() + if __nvmlDeviceGetGridLicensableFeatures_v4 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGridLicensableFeatures_v4 is not found") + return (__nvmlDeviceGetGridLicensableFeatures_v4)( + device, pGridLicensableFeatures) + + +cdef nvmlReturn_t _nvmlGetVgpuDriverCapabilities(nvmlVgpuDriverCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGetVgpuDriverCapabilities + _check_or_init_nvml() + if __nvmlGetVgpuDriverCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGetVgpuDriverCapabilities is not found") + return (__nvmlGetVgpuDriverCapabilities)( + capability, capResult) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuCapabilities(nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuCapabilities + _check_or_init_nvml() + if __nvmlDeviceGetVgpuCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuCapabilities is not found") + return (__nvmlDeviceGetVgpuCapabilities)( + device, capability, capResult) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuTypeId_t* vgpuTypeIds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedVgpus + _check_or_init_nvml() + if __nvmlDeviceGetSupportedVgpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedVgpus is not found") + return (__nvmlDeviceGetSupportedVgpus)( + device, vgpuCount, vgpuTypeIds) + + +cdef nvmlReturn_t _nvmlDeviceGetCreatableVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuTypeId_t* vgpuTypeIds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCreatableVgpus + _check_or_init_nvml() + if __nvmlDeviceGetCreatableVgpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCreatableVgpus is not found") + return (__nvmlDeviceGetCreatableVgpus)( + device, vgpuCount, vgpuTypeIds) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetClass(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeClass, unsigned int* size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetClass + _check_or_init_nvml() + if __nvmlVgpuTypeGetClass == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetClass is not found") + return (__nvmlVgpuTypeGetClass)( + vgpuTypeId, vgpuTypeClass, size) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetName(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeName, unsigned int* size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetName + _check_or_init_nvml() + if __nvmlVgpuTypeGetName == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetName is not found") + return (__nvmlVgpuTypeGetName)( + vgpuTypeId, vgpuTypeName, size) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetGpuInstanceProfileId(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* gpuInstanceProfileId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetGpuInstanceProfileId + _check_or_init_nvml() + if __nvmlVgpuTypeGetGpuInstanceProfileId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetGpuInstanceProfileId is not found") + return (__nvmlVgpuTypeGetGpuInstanceProfileId)( + vgpuTypeId, gpuInstanceProfileId) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetDeviceID(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* deviceID, unsigned long long* subsystemID) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetDeviceID + _check_or_init_nvml() + if __nvmlVgpuTypeGetDeviceID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetDeviceID is not found") + return (__nvmlVgpuTypeGetDeviceID)( + vgpuTypeId, deviceID, subsystemID) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetFramebufferSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetFramebufferSize + _check_or_init_nvml() + if __nvmlVgpuTypeGetFramebufferSize == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetFramebufferSize is not found") + return (__nvmlVgpuTypeGetFramebufferSize)( + vgpuTypeId, fbSize) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetNumDisplayHeads(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* numDisplayHeads) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetNumDisplayHeads + _check_or_init_nvml() + if __nvmlVgpuTypeGetNumDisplayHeads == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetNumDisplayHeads is not found") + return (__nvmlVgpuTypeGetNumDisplayHeads)( + vgpuTypeId, numDisplayHeads) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetResolution(nvmlVgpuTypeId_t vgpuTypeId, unsigned int displayIndex, unsigned int* xdim, unsigned int* ydim) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetResolution + _check_or_init_nvml() + if __nvmlVgpuTypeGetResolution == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetResolution is not found") + return (__nvmlVgpuTypeGetResolution)( + vgpuTypeId, displayIndex, xdim, ydim) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetLicense(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeLicenseString, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetLicense + _check_or_init_nvml() + if __nvmlVgpuTypeGetLicense == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetLicense is not found") + return (__nvmlVgpuTypeGetLicense)( + vgpuTypeId, vgpuTypeLicenseString, size) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetFrameRateLimit(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* frameRateLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetFrameRateLimit + _check_or_init_nvml() + if __nvmlVgpuTypeGetFrameRateLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetFrameRateLimit is not found") + return (__nvmlVgpuTypeGetFrameRateLimit)( + vgpuTypeId, frameRateLimit) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetMaxInstances(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, unsigned int* vgpuInstanceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetMaxInstances + _check_or_init_nvml() + if __nvmlVgpuTypeGetMaxInstances == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetMaxInstances is not found") + return (__nvmlVgpuTypeGetMaxInstances)( + device, vgpuTypeId, vgpuInstanceCount) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetMaxInstancesPerVm(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* vgpuInstanceCountPerVm) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetMaxInstancesPerVm + _check_or_init_nvml() + if __nvmlVgpuTypeGetMaxInstancesPerVm == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetMaxInstancesPerVm is not found") + return (__nvmlVgpuTypeGetMaxInstancesPerVm)( + vgpuTypeId, vgpuInstanceCountPerVm) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetBAR1Info(nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuTypeBar1Info_t* bar1Info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetBAR1Info + _check_or_init_nvml() + if __nvmlVgpuTypeGetBAR1Info == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetBAR1Info is not found") + return (__nvmlVgpuTypeGetBAR1Info)( + vgpuTypeId, bar1Info) + + +cdef nvmlReturn_t _nvmlDeviceGetActiveVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuInstance_t* vgpuInstances) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetActiveVgpus + _check_or_init_nvml() + if __nvmlDeviceGetActiveVgpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetActiveVgpus is not found") + return (__nvmlDeviceGetActiveVgpus)( + device, vgpuCount, vgpuInstances) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetVmID(nvmlVgpuInstance_t vgpuInstance, char* vmId, unsigned int size, nvmlVgpuVmIdType_t* vmIdType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetVmID + _check_or_init_nvml() + if __nvmlVgpuInstanceGetVmID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetVmID is not found") + return (__nvmlVgpuInstanceGetVmID)( + vgpuInstance, vmId, size, vmIdType) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetUUID(nvmlVgpuInstance_t vgpuInstance, char* uuid, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetUUID + _check_or_init_nvml() + if __nvmlVgpuInstanceGetUUID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetUUID is not found") + return (__nvmlVgpuInstanceGetUUID)( + vgpuInstance, uuid, size) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetVmDriverVersion(nvmlVgpuInstance_t vgpuInstance, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetVmDriverVersion + _check_or_init_nvml() + if __nvmlVgpuInstanceGetVmDriverVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetVmDriverVersion is not found") + return (__nvmlVgpuInstanceGetVmDriverVersion)( + vgpuInstance, version, length) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetFbUsage(nvmlVgpuInstance_t vgpuInstance, unsigned long long* fbUsage) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetFbUsage + _check_or_init_nvml() + if __nvmlVgpuInstanceGetFbUsage == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetFbUsage is not found") + return (__nvmlVgpuInstanceGetFbUsage)( + vgpuInstance, fbUsage) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetLicenseStatus(nvmlVgpuInstance_t vgpuInstance, unsigned int* licensed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetLicenseStatus + _check_or_init_nvml() + if __nvmlVgpuInstanceGetLicenseStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetLicenseStatus is not found") + return (__nvmlVgpuInstanceGetLicenseStatus)( + vgpuInstance, licensed) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetType(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuTypeId_t* vgpuTypeId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetType + _check_or_init_nvml() + if __nvmlVgpuInstanceGetType == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetType is not found") + return (__nvmlVgpuInstanceGetType)( + vgpuInstance, vgpuTypeId) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetFrameRateLimit(nvmlVgpuInstance_t vgpuInstance, unsigned int* frameRateLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetFrameRateLimit + _check_or_init_nvml() + if __nvmlVgpuInstanceGetFrameRateLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetFrameRateLimit is not found") + return (__nvmlVgpuInstanceGetFrameRateLimit)( + vgpuInstance, frameRateLimit) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetEccMode(nvmlVgpuInstance_t vgpuInstance, nvmlEnableState_t* eccMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetEccMode + _check_or_init_nvml() + if __nvmlVgpuInstanceGetEccMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetEccMode is not found") + return (__nvmlVgpuInstanceGetEccMode)( + vgpuInstance, eccMode) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int* encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetEncoderCapacity + _check_or_init_nvml() + if __nvmlVgpuInstanceGetEncoderCapacity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetEncoderCapacity is not found") + return (__nvmlVgpuInstanceGetEncoderCapacity)( + vgpuInstance, encoderCapacity) + + +cdef nvmlReturn_t _nvmlVgpuInstanceSetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceSetEncoderCapacity + _check_or_init_nvml() + if __nvmlVgpuInstanceSetEncoderCapacity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceSetEncoderCapacity is not found") + return (__nvmlVgpuInstanceSetEncoderCapacity)( + vgpuInstance, encoderCapacity) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetEncoderStats(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, unsigned int* averageFps, unsigned int* averageLatency) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetEncoderStats + _check_or_init_nvml() + if __nvmlVgpuInstanceGetEncoderStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetEncoderStats is not found") + return (__nvmlVgpuInstanceGetEncoderStats)( + vgpuInstance, sessionCount, averageFps, averageLatency) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetEncoderSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, nvmlEncoderSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetEncoderSessions + _check_or_init_nvml() + if __nvmlVgpuInstanceGetEncoderSessions == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetEncoderSessions is not found") + return (__nvmlVgpuInstanceGetEncoderSessions)( + vgpuInstance, sessionCount, sessionInfo) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetFBCStats(nvmlVgpuInstance_t vgpuInstance, nvmlFBCStats_t* fbcStats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetFBCStats + _check_or_init_nvml() + if __nvmlVgpuInstanceGetFBCStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetFBCStats is not found") + return (__nvmlVgpuInstanceGetFBCStats)( + vgpuInstance, fbcStats) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetFBCSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, nvmlFBCSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetFBCSessions + _check_or_init_nvml() + if __nvmlVgpuInstanceGetFBCSessions == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetFBCSessions is not found") + return (__nvmlVgpuInstanceGetFBCSessions)( + vgpuInstance, sessionCount, sessionInfo) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetGpuInstanceId(nvmlVgpuInstance_t vgpuInstance, unsigned int* gpuInstanceId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetGpuInstanceId + _check_or_init_nvml() + if __nvmlVgpuInstanceGetGpuInstanceId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetGpuInstanceId is not found") + return (__nvmlVgpuInstanceGetGpuInstanceId)( + vgpuInstance, gpuInstanceId) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetGpuPciId(nvmlVgpuInstance_t vgpuInstance, char* vgpuPciId, unsigned int* length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetGpuPciId + _check_or_init_nvml() + if __nvmlVgpuInstanceGetGpuPciId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetGpuPciId is not found") + return (__nvmlVgpuInstanceGetGpuPciId)( + vgpuInstance, vgpuPciId, length) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetCapabilities(nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetCapabilities + _check_or_init_nvml() + if __nvmlVgpuTypeGetCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetCapabilities is not found") + return (__nvmlVgpuTypeGetCapabilities)( + vgpuTypeId, capability, capResult) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetMdevUUID(nvmlVgpuInstance_t vgpuInstance, char* mdevUuid, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetMdevUUID + _check_or_init_nvml() + if __nvmlVgpuInstanceGetMdevUUID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetMdevUUID is not found") + return (__nvmlVgpuInstanceGetMdevUUID)( + vgpuInstance, mdevUuid, size) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetCreatableVgpus(nvmlGpuInstance_t gpuInstance, nvmlVgpuTypeIdInfo_t* pVgpus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetCreatableVgpus + _check_or_init_nvml() + if __nvmlGpuInstanceGetCreatableVgpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetCreatableVgpus is not found") + return (__nvmlGpuInstanceGetCreatableVgpus)( + gpuInstance, pVgpus) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetMaxInstancesPerGpuInstance(nvmlVgpuTypeMaxInstance_t* pMaxInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetMaxInstancesPerGpuInstance + _check_or_init_nvml() + if __nvmlVgpuTypeGetMaxInstancesPerGpuInstance == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetMaxInstancesPerGpuInstance is not found") + return (__nvmlVgpuTypeGetMaxInstancesPerGpuInstance)( + pMaxInstance) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetActiveVgpus(nvmlGpuInstance_t gpuInstance, nvmlActiveVgpuInstanceInfo_t* pVgpuInstanceInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetActiveVgpus + _check_or_init_nvml() + if __nvmlGpuInstanceGetActiveVgpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetActiveVgpus is not found") + return (__nvmlGpuInstanceGetActiveVgpus)( + gpuInstance, pVgpuInstanceInfo) + + +cdef nvmlReturn_t _nvmlGpuInstanceSetVgpuSchedulerState(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerState_t* pScheduler) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceSetVgpuSchedulerState + _check_or_init_nvml() + if __nvmlGpuInstanceSetVgpuSchedulerState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceSetVgpuSchedulerState is not found") + return (__nvmlGpuInstanceSetVgpuSchedulerState)( + gpuInstance, pScheduler) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuSchedulerState(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerStateInfo_t* pSchedulerStateInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetVgpuSchedulerState + _check_or_init_nvml() + if __nvmlGpuInstanceGetVgpuSchedulerState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetVgpuSchedulerState is not found") + return (__nvmlGpuInstanceGetVgpuSchedulerState)( + gpuInstance, pSchedulerStateInfo) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuSchedulerLog(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerLogInfo_t* pSchedulerLogInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetVgpuSchedulerLog + _check_or_init_nvml() + if __nvmlGpuInstanceGetVgpuSchedulerLog == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetVgpuSchedulerLog is not found") + return (__nvmlGpuInstanceGetVgpuSchedulerLog)( + gpuInstance, pSchedulerLogInfo) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuTypeCreatablePlacements(nvmlGpuInstance_t gpuInstance, nvmlVgpuCreatablePlacementInfo_t* pCreatablePlacementInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetVgpuTypeCreatablePlacements + _check_or_init_nvml() + if __nvmlGpuInstanceGetVgpuTypeCreatablePlacements == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetVgpuTypeCreatablePlacements is not found") + return (__nvmlGpuInstanceGetVgpuTypeCreatablePlacements)( + gpuInstance, pCreatablePlacementInfo) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuHeterogeneousMode(nvmlGpuInstance_t gpuInstance, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetVgpuHeterogeneousMode + _check_or_init_nvml() + if __nvmlGpuInstanceGetVgpuHeterogeneousMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetVgpuHeterogeneousMode is not found") + return (__nvmlGpuInstanceGetVgpuHeterogeneousMode)( + gpuInstance, pHeterogeneousMode) + + +cdef nvmlReturn_t _nvmlGpuInstanceSetVgpuHeterogeneousMode(nvmlGpuInstance_t gpuInstance, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceSetVgpuHeterogeneousMode + _check_or_init_nvml() + if __nvmlGpuInstanceSetVgpuHeterogeneousMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceSetVgpuHeterogeneousMode is not found") + return (__nvmlGpuInstanceSetVgpuHeterogeneousMode)( + gpuInstance, pHeterogeneousMode) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetMetadata(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuMetadata_t* vgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetMetadata + _check_or_init_nvml() + if __nvmlVgpuInstanceGetMetadata == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetMetadata is not found") + return (__nvmlVgpuInstanceGetMetadata)( + vgpuInstance, vgpuMetadata, bufferSize) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuMetadata(nvmlDevice_t device, nvmlVgpuPgpuMetadata_t* pgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuMetadata + _check_or_init_nvml() + if __nvmlDeviceGetVgpuMetadata == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuMetadata is not found") + return (__nvmlDeviceGetVgpuMetadata)( + device, pgpuMetadata, bufferSize) + + +cdef nvmlReturn_t _nvmlGetVgpuCompatibility(nvmlVgpuMetadata_t* vgpuMetadata, nvmlVgpuPgpuMetadata_t* pgpuMetadata, nvmlVgpuPgpuCompatibility_t* compatibilityInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGetVgpuCompatibility + _check_or_init_nvml() + if __nvmlGetVgpuCompatibility == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGetVgpuCompatibility is not found") + return (__nvmlGetVgpuCompatibility)( + vgpuMetadata, pgpuMetadata, compatibilityInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetPgpuMetadataString(nvmlDevice_t device, char* pgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPgpuMetadataString + _check_or_init_nvml() + if __nvmlDeviceGetPgpuMetadataString == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPgpuMetadataString is not found") + return (__nvmlDeviceGetPgpuMetadataString)( + device, pgpuMetadata, bufferSize) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerLog(nvmlDevice_t device, nvmlVgpuSchedulerLog_t* pSchedulerLog) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuSchedulerLog + _check_or_init_nvml() + if __nvmlDeviceGetVgpuSchedulerLog == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuSchedulerLog is not found") + return (__nvmlDeviceGetVgpuSchedulerLog)( + device, pSchedulerLog) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerState(nvmlDevice_t device, nvmlVgpuSchedulerGetState_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuSchedulerState + _check_or_init_nvml() + if __nvmlDeviceGetVgpuSchedulerState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuSchedulerState is not found") + return (__nvmlDeviceGetVgpuSchedulerState)( + device, pSchedulerState) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerCapabilities(nvmlDevice_t device, nvmlVgpuSchedulerCapabilities_t* pCapabilities) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuSchedulerCapabilities + _check_or_init_nvml() + if __nvmlDeviceGetVgpuSchedulerCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuSchedulerCapabilities is not found") + return (__nvmlDeviceGetVgpuSchedulerCapabilities)( + device, pCapabilities) + + +cdef nvmlReturn_t _nvmlDeviceSetVgpuSchedulerState(nvmlDevice_t device, nvmlVgpuSchedulerSetState_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetVgpuSchedulerState + _check_or_init_nvml() + if __nvmlDeviceSetVgpuSchedulerState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetVgpuSchedulerState is not found") + return (__nvmlDeviceSetVgpuSchedulerState)( + device, pSchedulerState) + + +cdef nvmlReturn_t _nvmlGetVgpuVersion(nvmlVgpuVersion_t* supported, nvmlVgpuVersion_t* current) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGetVgpuVersion + _check_or_init_nvml() + if __nvmlGetVgpuVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGetVgpuVersion is not found") + return (__nvmlGetVgpuVersion)( + supported, current) + + +cdef nvmlReturn_t _nvmlSetVgpuVersion(nvmlVgpuVersion_t* vgpuVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSetVgpuVersion + _check_or_init_nvml() + if __nvmlSetVgpuVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSetVgpuVersion is not found") + return (__nvmlSetVgpuVersion)( + vgpuVersion) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, nvmlValueType_t* sampleValType, unsigned int* vgpuInstanceSamplesCount, nvmlVgpuInstanceUtilizationSample_t* utilizationSamples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuUtilization + _check_or_init_nvml() + if __nvmlDeviceGetVgpuUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuUtilization is not found") + return (__nvmlDeviceGetVgpuUtilization)( + device, lastSeenTimeStamp, sampleValType, vgpuInstanceSamplesCount, utilizationSamples) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuInstancesUtilizationInfo(nvmlDevice_t device, nvmlVgpuInstancesUtilizationInfo_t* vgpuUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuInstancesUtilizationInfo + _check_or_init_nvml() + if __nvmlDeviceGetVgpuInstancesUtilizationInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuInstancesUtilizationInfo is not found") + return (__nvmlDeviceGetVgpuInstancesUtilizationInfo)( + device, vgpuUtilInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuProcessUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, unsigned int* vgpuProcessSamplesCount, nvmlVgpuProcessUtilizationSample_t* utilizationSamples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuProcessUtilization + _check_or_init_nvml() + if __nvmlDeviceGetVgpuProcessUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuProcessUtilization is not found") + return (__nvmlDeviceGetVgpuProcessUtilization)( + device, lastSeenTimeStamp, vgpuProcessSamplesCount, utilizationSamples) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuProcessesUtilizationInfo(nvmlDevice_t device, nvmlVgpuProcessesUtilizationInfo_t* vgpuProcUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuProcessesUtilizationInfo + _check_or_init_nvml() + if __nvmlDeviceGetVgpuProcessesUtilizationInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuProcessesUtilizationInfo is not found") + return (__nvmlDeviceGetVgpuProcessesUtilizationInfo)( + device, vgpuProcUtilInfo) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetAccountingMode(nvmlVgpuInstance_t vgpuInstance, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetAccountingMode + _check_or_init_nvml() + if __nvmlVgpuInstanceGetAccountingMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetAccountingMode is not found") + return (__nvmlVgpuInstanceGetAccountingMode)( + vgpuInstance, mode) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetAccountingPids(nvmlVgpuInstance_t vgpuInstance, unsigned int* count, unsigned int* pids) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetAccountingPids + _check_or_init_nvml() + if __nvmlVgpuInstanceGetAccountingPids == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetAccountingPids is not found") + return (__nvmlVgpuInstanceGetAccountingPids)( + vgpuInstance, count, pids) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetAccountingStats(nvmlVgpuInstance_t vgpuInstance, unsigned int pid, nvmlAccountingStats_t* stats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetAccountingStats + _check_or_init_nvml() + if __nvmlVgpuInstanceGetAccountingStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetAccountingStats is not found") + return (__nvmlVgpuInstanceGetAccountingStats)( + vgpuInstance, pid, stats) + + +cdef nvmlReturn_t _nvmlVgpuInstanceClearAccountingPids(nvmlVgpuInstance_t vgpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceClearAccountingPids + _check_or_init_nvml() + if __nvmlVgpuInstanceClearAccountingPids == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceClearAccountingPids is not found") + return (__nvmlVgpuInstanceClearAccountingPids)( + vgpuInstance) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetLicenseInfo_v2(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuLicenseInfo_t* licenseInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetLicenseInfo_v2 + _check_or_init_nvml() + if __nvmlVgpuInstanceGetLicenseInfo_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetLicenseInfo_v2 is not found") + return (__nvmlVgpuInstanceGetLicenseInfo_v2)( + vgpuInstance, licenseInfo) + + +cdef nvmlReturn_t _nvmlGetExcludedDeviceCount(unsigned int* deviceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGetExcludedDeviceCount + _check_or_init_nvml() + if __nvmlGetExcludedDeviceCount == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGetExcludedDeviceCount is not found") + return (__nvmlGetExcludedDeviceCount)( + deviceCount) + + +cdef nvmlReturn_t _nvmlGetExcludedDeviceInfoByIndex(unsigned int index, nvmlExcludedDeviceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGetExcludedDeviceInfoByIndex + _check_or_init_nvml() + if __nvmlGetExcludedDeviceInfoByIndex == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGetExcludedDeviceInfoByIndex is not found") + return (__nvmlGetExcludedDeviceInfoByIndex)( + index, info) + + +cdef nvmlReturn_t _nvmlDeviceSetMigMode(nvmlDevice_t device, unsigned int mode, nvmlReturn_t* activationStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetMigMode + _check_or_init_nvml() + if __nvmlDeviceSetMigMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetMigMode is not found") + return (__nvmlDeviceSetMigMode)( + device, mode, activationStatus) + + +cdef nvmlReturn_t _nvmlDeviceGetMigMode(nvmlDevice_t device, unsigned int* currentMode, unsigned int* pendingMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMigMode + _check_or_init_nvml() + if __nvmlDeviceGetMigMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMigMode is not found") + return (__nvmlDeviceGetMigMode)( + device, currentMode, pendingMode) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceProfileInfoV(nvmlDevice_t device, unsigned int profile, nvmlGpuInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstanceProfileInfoV + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstanceProfileInfoV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstanceProfileInfoV is not found") + return (__nvmlDeviceGetGpuInstanceProfileInfoV)( + device, profile, info) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstancePossiblePlacements_v2(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstancePlacement_t* placements, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstancePossiblePlacements_v2 + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstancePossiblePlacements_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstancePossiblePlacements_v2 is not found") + return (__nvmlDeviceGetGpuInstancePossiblePlacements_v2)( + device, profileId, placements, count) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceRemainingCapacity(nvmlDevice_t device, unsigned int profileId, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstanceRemainingCapacity + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstanceRemainingCapacity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstanceRemainingCapacity is not found") + return (__nvmlDeviceGetGpuInstanceRemainingCapacity)( + device, profileId, count) + + +cdef nvmlReturn_t _nvmlDeviceCreateGpuInstance(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceCreateGpuInstance + _check_or_init_nvml() + if __nvmlDeviceCreateGpuInstance == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceCreateGpuInstance is not found") + return (__nvmlDeviceCreateGpuInstance)( + device, profileId, gpuInstance) + + +cdef nvmlReturn_t _nvmlDeviceCreateGpuInstanceWithPlacement(nvmlDevice_t device, unsigned int profileId, const nvmlGpuInstancePlacement_t* placement, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceCreateGpuInstanceWithPlacement + _check_or_init_nvml() + if __nvmlDeviceCreateGpuInstanceWithPlacement == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceCreateGpuInstanceWithPlacement is not found") + return (__nvmlDeviceCreateGpuInstanceWithPlacement)( + device, profileId, placement, gpuInstance) + + +cdef nvmlReturn_t _nvmlGpuInstanceDestroy(nvmlGpuInstance_t gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceDestroy + _check_or_init_nvml() + if __nvmlGpuInstanceDestroy == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceDestroy is not found") + return (__nvmlGpuInstanceDestroy)( + gpuInstance) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstances(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t* gpuInstances, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstances + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstances == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstances is not found") + return (__nvmlDeviceGetGpuInstances)( + device, profileId, gpuInstances, count) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceById(nvmlDevice_t device, unsigned int id, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstanceById + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstanceById == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstanceById is not found") + return (__nvmlDeviceGetGpuInstanceById)( + device, id, gpuInstance) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetInfo(nvmlGpuInstance_t gpuInstance, nvmlGpuInstanceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetInfo + _check_or_init_nvml() + if __nvmlGpuInstanceGetInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetInfo is not found") + return (__nvmlGpuInstanceGetInfo)( + gpuInstance, info) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstanceProfileInfoV(nvmlGpuInstance_t gpuInstance, unsigned int profile, unsigned int engProfile, nvmlComputeInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetComputeInstanceProfileInfoV + _check_or_init_nvml() + if __nvmlGpuInstanceGetComputeInstanceProfileInfoV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetComputeInstanceProfileInfoV is not found") + return (__nvmlGpuInstanceGetComputeInstanceProfileInfoV)( + gpuInstance, profile, engProfile, info) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstanceRemainingCapacity(nvmlGpuInstance_t gpuInstance, unsigned int profileId, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetComputeInstanceRemainingCapacity + _check_or_init_nvml() + if __nvmlGpuInstanceGetComputeInstanceRemainingCapacity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetComputeInstanceRemainingCapacity is not found") + return (__nvmlGpuInstanceGetComputeInstanceRemainingCapacity)( + gpuInstance, profileId, count) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstancePossiblePlacements(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstancePlacement_t* placements, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetComputeInstancePossiblePlacements + _check_or_init_nvml() + if __nvmlGpuInstanceGetComputeInstancePossiblePlacements == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetComputeInstancePossiblePlacements is not found") + return (__nvmlGpuInstanceGetComputeInstancePossiblePlacements)( + gpuInstance, profileId, placements, count) + + +cdef nvmlReturn_t _nvmlGpuInstanceCreateComputeInstance(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceCreateComputeInstance + _check_or_init_nvml() + if __nvmlGpuInstanceCreateComputeInstance == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceCreateComputeInstance is not found") + return (__nvmlGpuInstanceCreateComputeInstance)( + gpuInstance, profileId, computeInstance) + + +cdef nvmlReturn_t _nvmlGpuInstanceCreateComputeInstanceWithPlacement(nvmlGpuInstance_t gpuInstance, unsigned int profileId, const nvmlComputeInstancePlacement_t* placement, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceCreateComputeInstanceWithPlacement + _check_or_init_nvml() + if __nvmlGpuInstanceCreateComputeInstanceWithPlacement == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceCreateComputeInstanceWithPlacement is not found") + return (__nvmlGpuInstanceCreateComputeInstanceWithPlacement)( + gpuInstance, profileId, placement, computeInstance) + + +cdef nvmlReturn_t _nvmlComputeInstanceDestroy(nvmlComputeInstance_t computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlComputeInstanceDestroy + _check_or_init_nvml() + if __nvmlComputeInstanceDestroy == NULL: + with gil: + raise FunctionNotFoundError("function nvmlComputeInstanceDestroy is not found") + return (__nvmlComputeInstanceDestroy)( + computeInstance) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstances(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t* computeInstances, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetComputeInstances + _check_or_init_nvml() + if __nvmlGpuInstanceGetComputeInstances == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetComputeInstances is not found") + return (__nvmlGpuInstanceGetComputeInstances)( + gpuInstance, profileId, computeInstances, count) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstanceById(nvmlGpuInstance_t gpuInstance, unsigned int id, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetComputeInstanceById + _check_or_init_nvml() + if __nvmlGpuInstanceGetComputeInstanceById == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetComputeInstanceById is not found") + return (__nvmlGpuInstanceGetComputeInstanceById)( + gpuInstance, id, computeInstance) + + +cdef nvmlReturn_t _nvmlComputeInstanceGetInfo_v2(nvmlComputeInstance_t computeInstance, nvmlComputeInstanceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlComputeInstanceGetInfo_v2 + _check_or_init_nvml() + if __nvmlComputeInstanceGetInfo_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlComputeInstanceGetInfo_v2 is not found") + return (__nvmlComputeInstanceGetInfo_v2)( + computeInstance, info) + + +cdef nvmlReturn_t _nvmlDeviceIsMigDeviceHandle(nvmlDevice_t device, unsigned int* isMigDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceIsMigDeviceHandle + _check_or_init_nvml() + if __nvmlDeviceIsMigDeviceHandle == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceIsMigDeviceHandle is not found") + return (__nvmlDeviceIsMigDeviceHandle)( + device, isMigDevice) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceId(nvmlDevice_t device, unsigned int* id) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstanceId + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstanceId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstanceId is not found") + return (__nvmlDeviceGetGpuInstanceId)( + device, id) + + +cdef nvmlReturn_t _nvmlDeviceGetComputeInstanceId(nvmlDevice_t device, unsigned int* id) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetComputeInstanceId + _check_or_init_nvml() + if __nvmlDeviceGetComputeInstanceId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetComputeInstanceId is not found") + return (__nvmlDeviceGetComputeInstanceId)( + device, id) + + +cdef nvmlReturn_t _nvmlDeviceGetMaxMigDeviceCount(nvmlDevice_t device, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMaxMigDeviceCount + _check_or_init_nvml() + if __nvmlDeviceGetMaxMigDeviceCount == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMaxMigDeviceCount is not found") + return (__nvmlDeviceGetMaxMigDeviceCount)( + device, count) + + +cdef nvmlReturn_t _nvmlDeviceGetMigDeviceHandleByIndex(nvmlDevice_t device, unsigned int index, nvmlDevice_t* migDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMigDeviceHandleByIndex + _check_or_init_nvml() + if __nvmlDeviceGetMigDeviceHandleByIndex == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMigDeviceHandleByIndex is not found") + return (__nvmlDeviceGetMigDeviceHandleByIndex)( + device, index, migDevice) + + +cdef nvmlReturn_t _nvmlDeviceGetDeviceHandleFromMigDeviceHandle(nvmlDevice_t migDevice, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDeviceHandleFromMigDeviceHandle + _check_or_init_nvml() + if __nvmlDeviceGetDeviceHandleFromMigDeviceHandle == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDeviceHandleFromMigDeviceHandle is not found") + return (__nvmlDeviceGetDeviceHandleFromMigDeviceHandle)( + migDevice, device) + + +cdef nvmlReturn_t _nvmlGpmSampleGet(nvmlDevice_t device, nvmlGpmSample_t gpmSample) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpmSampleGet + _check_or_init_nvml() + if __nvmlGpmSampleGet == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpmSampleGet is not found") + return (__nvmlGpmSampleGet)( + device, gpmSample) + + +cdef nvmlReturn_t _nvmlGpmMigSampleGet(nvmlDevice_t device, unsigned int gpuInstanceId, nvmlGpmSample_t gpmSample) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpmMigSampleGet + _check_or_init_nvml() + if __nvmlGpmMigSampleGet == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpmMigSampleGet is not found") + return (__nvmlGpmMigSampleGet)( + device, gpuInstanceId, gpmSample) + + +cdef nvmlReturn_t _nvmlGpmQueryDeviceSupport(nvmlDevice_t device, nvmlGpmSupport_t* gpmSupport) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpmQueryDeviceSupport + _check_or_init_nvml() + if __nvmlGpmQueryDeviceSupport == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpmQueryDeviceSupport is not found") + return (__nvmlGpmQueryDeviceSupport)( + device, gpmSupport) + + +cdef nvmlReturn_t _nvmlGpmQueryIfStreamingEnabled(nvmlDevice_t device, unsigned int* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpmQueryIfStreamingEnabled + _check_or_init_nvml() + if __nvmlGpmQueryIfStreamingEnabled == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpmQueryIfStreamingEnabled is not found") + return (__nvmlGpmQueryIfStreamingEnabled)( + device, state) + + +cdef nvmlReturn_t _nvmlGpmSetStreamingEnabled(nvmlDevice_t device, unsigned int state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpmSetStreamingEnabled + _check_or_init_nvml() + if __nvmlGpmSetStreamingEnabled == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpmSetStreamingEnabled is not found") + return (__nvmlGpmSetStreamingEnabled)( + device, state) + + +cdef nvmlReturn_t _nvmlDeviceGetCapabilities(nvmlDevice_t device, nvmlDeviceCapabilities_t* caps) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCapabilities + _check_or_init_nvml() + if __nvmlDeviceGetCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCapabilities is not found") + return (__nvmlDeviceGetCapabilities)( + device, caps) + + +cdef nvmlReturn_t _nvmlDeviceWorkloadPowerProfileClearRequestedProfiles(nvmlDevice_t device, nvmlWorkloadPowerProfileRequestedProfiles_t* requestedProfiles) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceWorkloadPowerProfileClearRequestedProfiles + _check_or_init_nvml() + if __nvmlDeviceWorkloadPowerProfileClearRequestedProfiles == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceWorkloadPowerProfileClearRequestedProfiles is not found") + return (__nvmlDeviceWorkloadPowerProfileClearRequestedProfiles)( + device, requestedProfiles) + + +cdef nvmlReturn_t _nvmlDevicePowerSmoothingActivatePresetProfile(nvmlDevice_t device, nvmlPowerSmoothingProfile_t* profile) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDevicePowerSmoothingActivatePresetProfile + _check_or_init_nvml() + if __nvmlDevicePowerSmoothingActivatePresetProfile == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDevicePowerSmoothingActivatePresetProfile is not found") + return (__nvmlDevicePowerSmoothingActivatePresetProfile)( + device, profile) + + +cdef nvmlReturn_t _nvmlDevicePowerSmoothingUpdatePresetProfileParam(nvmlDevice_t device, nvmlPowerSmoothingProfile_t* profile) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDevicePowerSmoothingUpdatePresetProfileParam + _check_or_init_nvml() + if __nvmlDevicePowerSmoothingUpdatePresetProfileParam == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDevicePowerSmoothingUpdatePresetProfileParam is not found") + return (__nvmlDevicePowerSmoothingUpdatePresetProfileParam)( + device, profile) + + +cdef nvmlReturn_t _nvmlDevicePowerSmoothingSetState(nvmlDevice_t device, nvmlPowerSmoothingState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDevicePowerSmoothingSetState + _check_or_init_nvml() + if __nvmlDevicePowerSmoothingSetState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDevicePowerSmoothingSetState is not found") + return (__nvmlDevicePowerSmoothingSetState)( + device, state) + + +cdef nvmlReturn_t _nvmlDeviceGetAddressingMode(nvmlDevice_t device, nvmlDeviceAddressingMode_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAddressingMode + _check_or_init_nvml() + if __nvmlDeviceGetAddressingMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAddressingMode is not found") + return (__nvmlDeviceGetAddressingMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceGetRepairStatus(nvmlDevice_t device, nvmlRepairStatus_t* repairStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRepairStatus + _check_or_init_nvml() + if __nvmlDeviceGetRepairStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRepairStatus is not found") + return (__nvmlDeviceGetRepairStatus)( + device, repairStatus) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t* powerMizerMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerMizerMode_v1 + _check_or_init_nvml() + if __nvmlDeviceGetPowerMizerMode_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerMizerMode_v1 is not found") + return (__nvmlDeviceGetPowerMizerMode_v1)( + device, powerMizerMode) + + +cdef nvmlReturn_t _nvmlDeviceSetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t* powerMizerMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetPowerMizerMode_v1 + _check_or_init_nvml() + if __nvmlDeviceSetPowerMizerMode_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetPowerMizerMode_v1 is not found") + return (__nvmlDeviceSetPowerMizerMode_v1)( + device, powerMizerMode) + + +cdef nvmlReturn_t _nvmlDeviceGetPdi(nvmlDevice_t device, nvmlPdi_t* pdi) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPdi + _check_or_init_nvml() + if __nvmlDeviceGetPdi == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPdi is not found") + return (__nvmlDeviceGetPdi)( + device, pdi) + + +cdef nvmlReturn_t _nvmlDeviceSetHostname_v1(nvmlDevice_t device, nvmlHostname_v1_t* hostname) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetHostname_v1 + _check_or_init_nvml() + if __nvmlDeviceSetHostname_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetHostname_v1 is not found") + return (__nvmlDeviceSetHostname_v1)( + device, hostname) + + +cdef nvmlReturn_t _nvmlDeviceGetHostname_v1(nvmlDevice_t device, nvmlHostname_v1_t* hostname) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHostname_v1 + _check_or_init_nvml() + if __nvmlDeviceGetHostname_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHostname_v1 is not found") + return (__nvmlDeviceGetHostname_v1)( + device, hostname) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkInfo(nvmlDevice_t device, nvmlNvLinkInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkInfo + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkInfo is not found") + return (__nvmlDeviceGetNvLinkInfo)( + device, info) + + +cdef nvmlReturn_t _nvmlDeviceReadWritePRM_v1(nvmlDevice_t device, nvmlPRMTLV_v1_t* buffer) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceReadWritePRM_v1 + _check_or_init_nvml() + if __nvmlDeviceReadWritePRM_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceReadWritePRM_v1 is not found") + return (__nvmlDeviceReadWritePRM_v1)( + device, buffer) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceProfileInfoByIdV(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstanceProfileInfoByIdV + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstanceProfileInfoByIdV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstanceProfileInfoByIdV is not found") + return (__nvmlDeviceGetGpuInstanceProfileInfoByIdV)( + device, profileId, info) + + +cdef nvmlReturn_t _nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(nvmlDevice_t device, nvmlEccSramUniqueUncorrectedErrorCounts_t* errorCounts) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts + _check_or_init_nvml() + if __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts is not found") + return (__nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts)( + device, errorCounts) diff --git a/cuda_bindings/cuda/bindings/_internal/nvml_windows.pyx b/cuda_bindings/cuda/bindings/_internal/nvml_windows.pyx new file mode 100644 index 0000000000..a13ca0ab71 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/nvml_windows.pyx @@ -0,0 +1,6000 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE +# +# This code was automatically generated across versions from 12.9.1 to 13.0.1. Do not modify it directly. + +from libc.stdint cimport intptr_t + +from .utils cimport get_nvml_dso_version_suffix + +import os +import site +import threading + +import win32api + +from .utils import FunctionNotFoundError, NotSupportedError + + +############################################################################### +# Wrapper init +############################################################################### + +LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800 +cdef object __symbol_lock = threading.Lock() +cdef bint __py_nvml_init = False +cdef void* __cuDriverGetVersion = NULL + +cdef void* __nvmlInit_v2 = NULL +cdef void* __nvmlInitWithFlags = NULL +cdef void* __nvmlShutdown = NULL +cdef void* __nvmlErrorString = NULL +cdef void* __nvmlSystemGetDriverVersion = NULL +cdef void* __nvmlSystemGetNVMLVersion = NULL +cdef void* __nvmlSystemGetCudaDriverVersion = NULL +cdef void* __nvmlSystemGetCudaDriverVersion_v2 = NULL +cdef void* __nvmlSystemGetProcessName = NULL +cdef void* __nvmlSystemGetHicVersion = NULL +cdef void* __nvmlSystemGetTopologyGpuSet = NULL +cdef void* __nvmlSystemGetDriverBranch = NULL +cdef void* __nvmlUnitGetCount = NULL +cdef void* __nvmlUnitGetHandleByIndex = NULL +cdef void* __nvmlUnitGetUnitInfo = NULL +cdef void* __nvmlUnitGetLedState = NULL +cdef void* __nvmlUnitGetPsuInfo = NULL +cdef void* __nvmlUnitGetTemperature = NULL +cdef void* __nvmlUnitGetFanSpeedInfo = NULL +cdef void* __nvmlUnitGetDevices = NULL +cdef void* __nvmlDeviceGetCount_v2 = NULL +cdef void* __nvmlDeviceGetAttributes_v2 = NULL +cdef void* __nvmlDeviceGetHandleByIndex_v2 = NULL +cdef void* __nvmlDeviceGetHandleBySerial = NULL +cdef void* __nvmlDeviceGetHandleByUUID = NULL +cdef void* __nvmlDeviceGetHandleByUUIDV = NULL +cdef void* __nvmlDeviceGetHandleByPciBusId_v2 = NULL +cdef void* __nvmlDeviceGetName = NULL +cdef void* __nvmlDeviceGetBrand = NULL +cdef void* __nvmlDeviceGetIndex = NULL +cdef void* __nvmlDeviceGetSerial = NULL +cdef void* __nvmlDeviceGetModuleId = NULL +cdef void* __nvmlDeviceGetC2cModeInfoV = NULL +cdef void* __nvmlDeviceGetMemoryAffinity = NULL +cdef void* __nvmlDeviceGetCpuAffinityWithinScope = NULL +cdef void* __nvmlDeviceGetCpuAffinity = NULL +cdef void* __nvmlDeviceSetCpuAffinity = NULL +cdef void* __nvmlDeviceClearCpuAffinity = NULL +cdef void* __nvmlDeviceGetNumaNodeId = NULL +cdef void* __nvmlDeviceGetTopologyCommonAncestor = NULL +cdef void* __nvmlDeviceGetTopologyNearestGpus = NULL +cdef void* __nvmlDeviceGetP2PStatus = NULL +cdef void* __nvmlDeviceGetUUID = NULL +cdef void* __nvmlDeviceGetMinorNumber = NULL +cdef void* __nvmlDeviceGetBoardPartNumber = NULL +cdef void* __nvmlDeviceGetInforomVersion = NULL +cdef void* __nvmlDeviceGetInforomImageVersion = NULL +cdef void* __nvmlDeviceGetInforomConfigurationChecksum = NULL +cdef void* __nvmlDeviceValidateInforom = NULL +cdef void* __nvmlDeviceGetLastBBXFlushTime = NULL +cdef void* __nvmlDeviceGetDisplayMode = NULL +cdef void* __nvmlDeviceGetDisplayActive = NULL +cdef void* __nvmlDeviceGetPersistenceMode = NULL +cdef void* __nvmlDeviceGetPciInfoExt = NULL +cdef void* __nvmlDeviceGetPciInfo_v3 = NULL +cdef void* __nvmlDeviceGetMaxPcieLinkGeneration = NULL +cdef void* __nvmlDeviceGetGpuMaxPcieLinkGeneration = NULL +cdef void* __nvmlDeviceGetMaxPcieLinkWidth = NULL +cdef void* __nvmlDeviceGetCurrPcieLinkGeneration = NULL +cdef void* __nvmlDeviceGetCurrPcieLinkWidth = NULL +cdef void* __nvmlDeviceGetPcieThroughput = NULL +cdef void* __nvmlDeviceGetPcieReplayCounter = NULL +cdef void* __nvmlDeviceGetClockInfo = NULL +cdef void* __nvmlDeviceGetMaxClockInfo = NULL +cdef void* __nvmlDeviceGetGpcClkVfOffset = NULL +cdef void* __nvmlDeviceGetClock = NULL +cdef void* __nvmlDeviceGetMaxCustomerBoostClock = NULL +cdef void* __nvmlDeviceGetSupportedMemoryClocks = NULL +cdef void* __nvmlDeviceGetSupportedGraphicsClocks = NULL +cdef void* __nvmlDeviceGetAutoBoostedClocksEnabled = NULL +cdef void* __nvmlDeviceGetFanSpeed = NULL +cdef void* __nvmlDeviceGetFanSpeed_v2 = NULL +cdef void* __nvmlDeviceGetFanSpeedRPM = NULL +cdef void* __nvmlDeviceGetTargetFanSpeed = NULL +cdef void* __nvmlDeviceGetMinMaxFanSpeed = NULL +cdef void* __nvmlDeviceGetFanControlPolicy_v2 = NULL +cdef void* __nvmlDeviceGetNumFans = NULL +cdef void* __nvmlDeviceGetCoolerInfo = NULL +cdef void* __nvmlDeviceGetTemperatureV = NULL +cdef void* __nvmlDeviceGetTemperatureThreshold = NULL +cdef void* __nvmlDeviceGetMarginTemperature = NULL +cdef void* __nvmlDeviceGetThermalSettings = NULL +cdef void* __nvmlDeviceGetPerformanceState = NULL +cdef void* __nvmlDeviceGetCurrentClocksEventReasons = NULL +cdef void* __nvmlDeviceGetSupportedClocksEventReasons = NULL +cdef void* __nvmlDeviceGetPowerState = NULL +cdef void* __nvmlDeviceGetDynamicPstatesInfo = NULL +cdef void* __nvmlDeviceGetMemClkVfOffset = NULL +cdef void* __nvmlDeviceGetMinMaxClockOfPState = NULL +cdef void* __nvmlDeviceGetSupportedPerformanceStates = NULL +cdef void* __nvmlDeviceGetGpcClkMinMaxVfOffset = NULL +cdef void* __nvmlDeviceGetMemClkMinMaxVfOffset = NULL +cdef void* __nvmlDeviceGetClockOffsets = NULL +cdef void* __nvmlDeviceSetClockOffsets = NULL +cdef void* __nvmlDeviceGetPerformanceModes = NULL +cdef void* __nvmlDeviceGetCurrentClockFreqs = NULL +cdef void* __nvmlDeviceGetPowerManagementLimit = NULL +cdef void* __nvmlDeviceGetPowerManagementLimitConstraints = NULL +cdef void* __nvmlDeviceGetPowerManagementDefaultLimit = NULL +cdef void* __nvmlDeviceGetPowerUsage = NULL +cdef void* __nvmlDeviceGetTotalEnergyConsumption = NULL +cdef void* __nvmlDeviceGetEnforcedPowerLimit = NULL +cdef void* __nvmlDeviceGetGpuOperationMode = NULL +cdef void* __nvmlDeviceGetMemoryInfo_v2 = NULL +cdef void* __nvmlDeviceGetComputeMode = NULL +cdef void* __nvmlDeviceGetCudaComputeCapability = NULL +cdef void* __nvmlDeviceGetDramEncryptionMode = NULL +cdef void* __nvmlDeviceSetDramEncryptionMode = NULL +cdef void* __nvmlDeviceGetEccMode = NULL +cdef void* __nvmlDeviceGetDefaultEccMode = NULL +cdef void* __nvmlDeviceGetBoardId = NULL +cdef void* __nvmlDeviceGetMultiGpuBoard = NULL +cdef void* __nvmlDeviceGetTotalEccErrors = NULL +cdef void* __nvmlDeviceGetMemoryErrorCounter = NULL +cdef void* __nvmlDeviceGetUtilizationRates = NULL +cdef void* __nvmlDeviceGetEncoderUtilization = NULL +cdef void* __nvmlDeviceGetEncoderCapacity = NULL +cdef void* __nvmlDeviceGetEncoderStats = NULL +cdef void* __nvmlDeviceGetEncoderSessions = NULL +cdef void* __nvmlDeviceGetDecoderUtilization = NULL +cdef void* __nvmlDeviceGetJpgUtilization = NULL +cdef void* __nvmlDeviceGetOfaUtilization = NULL +cdef void* __nvmlDeviceGetFBCStats = NULL +cdef void* __nvmlDeviceGetFBCSessions = NULL +cdef void* __nvmlDeviceGetDriverModel_v2 = NULL +cdef void* __nvmlDeviceGetVbiosVersion = NULL +cdef void* __nvmlDeviceGetBridgeChipInfo = NULL +cdef void* __nvmlDeviceGetComputeRunningProcesses_v3 = NULL +cdef void* __nvmlDeviceGetGraphicsRunningProcesses_v3 = NULL +cdef void* __nvmlDeviceGetMPSComputeRunningProcesses_v3 = NULL +cdef void* __nvmlDeviceGetRunningProcessDetailList = NULL +cdef void* __nvmlDeviceOnSameBoard = NULL +cdef void* __nvmlDeviceGetAPIRestriction = NULL +cdef void* __nvmlDeviceGetSamples = NULL +cdef void* __nvmlDeviceGetBAR1MemoryInfo = NULL +cdef void* __nvmlDeviceGetIrqNum = NULL +cdef void* __nvmlDeviceGetNumGpuCores = NULL +cdef void* __nvmlDeviceGetPowerSource = NULL +cdef void* __nvmlDeviceGetMemoryBusWidth = NULL +cdef void* __nvmlDeviceGetPcieLinkMaxSpeed = NULL +cdef void* __nvmlDeviceGetPcieSpeed = NULL +cdef void* __nvmlDeviceGetAdaptiveClockInfoStatus = NULL +cdef void* __nvmlDeviceGetBusType = NULL +cdef void* __nvmlDeviceGetGpuFabricInfoV = NULL +cdef void* __nvmlSystemGetConfComputeCapabilities = NULL +cdef void* __nvmlSystemGetConfComputeState = NULL +cdef void* __nvmlDeviceGetConfComputeMemSizeInfo = NULL +cdef void* __nvmlSystemGetConfComputeGpusReadyState = NULL +cdef void* __nvmlDeviceGetConfComputeProtectedMemoryUsage = NULL +cdef void* __nvmlDeviceGetConfComputeGpuCertificate = NULL +cdef void* __nvmlDeviceGetConfComputeGpuAttestationReport = NULL +cdef void* __nvmlSystemGetConfComputeKeyRotationThresholdInfo = NULL +cdef void* __nvmlDeviceSetConfComputeUnprotectedMemSize = NULL +cdef void* __nvmlSystemSetConfComputeGpusReadyState = NULL +cdef void* __nvmlSystemSetConfComputeKeyRotationThresholdInfo = NULL +cdef void* __nvmlSystemGetConfComputeSettings = NULL +cdef void* __nvmlDeviceGetGspFirmwareVersion = NULL +cdef void* __nvmlDeviceGetGspFirmwareMode = NULL +cdef void* __nvmlDeviceGetSramEccErrorStatus = NULL +cdef void* __nvmlDeviceGetAccountingMode = NULL +cdef void* __nvmlDeviceGetAccountingStats = NULL +cdef void* __nvmlDeviceGetAccountingPids = NULL +cdef void* __nvmlDeviceGetAccountingBufferSize = NULL +cdef void* __nvmlDeviceGetRetiredPages = NULL +cdef void* __nvmlDeviceGetRetiredPages_v2 = NULL +cdef void* __nvmlDeviceGetRetiredPagesPendingStatus = NULL +cdef void* __nvmlDeviceGetRemappedRows = NULL +cdef void* __nvmlDeviceGetRowRemapperHistogram = NULL +cdef void* __nvmlDeviceGetArchitecture = NULL +cdef void* __nvmlDeviceGetClkMonStatus = NULL +cdef void* __nvmlDeviceGetProcessUtilization = NULL +cdef void* __nvmlDeviceGetProcessesUtilizationInfo = NULL +cdef void* __nvmlDeviceGetPlatformInfo = NULL +cdef void* __nvmlUnitSetLedState = NULL +cdef void* __nvmlDeviceSetPersistenceMode = NULL +cdef void* __nvmlDeviceSetComputeMode = NULL +cdef void* __nvmlDeviceSetEccMode = NULL +cdef void* __nvmlDeviceClearEccErrorCounts = NULL +cdef void* __nvmlDeviceSetDriverModel = NULL +cdef void* __nvmlDeviceSetGpuLockedClocks = NULL +cdef void* __nvmlDeviceResetGpuLockedClocks = NULL +cdef void* __nvmlDeviceSetMemoryLockedClocks = NULL +cdef void* __nvmlDeviceResetMemoryLockedClocks = NULL +cdef void* __nvmlDeviceSetAutoBoostedClocksEnabled = NULL +cdef void* __nvmlDeviceSetDefaultAutoBoostedClocksEnabled = NULL +cdef void* __nvmlDeviceSetDefaultFanSpeed_v2 = NULL +cdef void* __nvmlDeviceSetFanControlPolicy = NULL +cdef void* __nvmlDeviceSetTemperatureThreshold = NULL +cdef void* __nvmlDeviceSetPowerManagementLimit = NULL +cdef void* __nvmlDeviceSetGpuOperationMode = NULL +cdef void* __nvmlDeviceSetAPIRestriction = NULL +cdef void* __nvmlDeviceSetFanSpeed_v2 = NULL +cdef void* __nvmlDeviceSetAccountingMode = NULL +cdef void* __nvmlDeviceClearAccountingPids = NULL +cdef void* __nvmlDeviceSetPowerManagementLimit_v2 = NULL +cdef void* __nvmlDeviceGetNvLinkState = NULL +cdef void* __nvmlDeviceGetNvLinkVersion = NULL +cdef void* __nvmlDeviceGetNvLinkCapability = NULL +cdef void* __nvmlDeviceGetNvLinkRemotePciInfo_v2 = NULL +cdef void* __nvmlDeviceGetNvLinkErrorCounter = NULL +cdef void* __nvmlDeviceResetNvLinkErrorCounters = NULL +cdef void* __nvmlDeviceGetNvLinkRemoteDeviceType = NULL +cdef void* __nvmlDeviceSetNvLinkDeviceLowPowerThreshold = NULL +cdef void* __nvmlSystemSetNvlinkBwMode = NULL +cdef void* __nvmlSystemGetNvlinkBwMode = NULL +cdef void* __nvmlDeviceGetNvlinkSupportedBwModes = NULL +cdef void* __nvmlDeviceGetNvlinkBwMode = NULL +cdef void* __nvmlDeviceSetNvlinkBwMode = NULL +cdef void* __nvmlEventSetCreate = NULL +cdef void* __nvmlDeviceRegisterEvents = NULL +cdef void* __nvmlDeviceGetSupportedEventTypes = NULL +cdef void* __nvmlEventSetWait_v2 = NULL +cdef void* __nvmlEventSetFree = NULL +cdef void* __nvmlSystemEventSetCreate = NULL +cdef void* __nvmlSystemEventSetFree = NULL +cdef void* __nvmlSystemRegisterEvents = NULL +cdef void* __nvmlSystemEventSetWait = NULL +cdef void* __nvmlDeviceModifyDrainState = NULL +cdef void* __nvmlDeviceQueryDrainState = NULL +cdef void* __nvmlDeviceRemoveGpu_v2 = NULL +cdef void* __nvmlDeviceDiscoverGpus = NULL +cdef void* __nvmlDeviceGetFieldValues = NULL +cdef void* __nvmlDeviceClearFieldValues = NULL +cdef void* __nvmlDeviceGetVirtualizationMode = NULL +cdef void* __nvmlDeviceGetHostVgpuMode = NULL +cdef void* __nvmlDeviceSetVirtualizationMode = NULL +cdef void* __nvmlDeviceGetVgpuHeterogeneousMode = NULL +cdef void* __nvmlDeviceSetVgpuHeterogeneousMode = NULL +cdef void* __nvmlVgpuInstanceGetPlacementId = NULL +cdef void* __nvmlDeviceGetVgpuTypeSupportedPlacements = NULL +cdef void* __nvmlDeviceGetVgpuTypeCreatablePlacements = NULL +cdef void* __nvmlVgpuTypeGetGspHeapSize = NULL +cdef void* __nvmlVgpuTypeGetFbReservation = NULL +cdef void* __nvmlVgpuInstanceGetRuntimeStateSize = NULL +cdef void* __nvmlDeviceSetVgpuCapabilities = NULL +cdef void* __nvmlDeviceGetGridLicensableFeatures_v4 = NULL +cdef void* __nvmlGetVgpuDriverCapabilities = NULL +cdef void* __nvmlDeviceGetVgpuCapabilities = NULL +cdef void* __nvmlDeviceGetSupportedVgpus = NULL +cdef void* __nvmlDeviceGetCreatableVgpus = NULL +cdef void* __nvmlVgpuTypeGetClass = NULL +cdef void* __nvmlVgpuTypeGetName = NULL +cdef void* __nvmlVgpuTypeGetGpuInstanceProfileId = NULL +cdef void* __nvmlVgpuTypeGetDeviceID = NULL +cdef void* __nvmlVgpuTypeGetFramebufferSize = NULL +cdef void* __nvmlVgpuTypeGetNumDisplayHeads = NULL +cdef void* __nvmlVgpuTypeGetResolution = NULL +cdef void* __nvmlVgpuTypeGetLicense = NULL +cdef void* __nvmlVgpuTypeGetFrameRateLimit = NULL +cdef void* __nvmlVgpuTypeGetMaxInstances = NULL +cdef void* __nvmlVgpuTypeGetMaxInstancesPerVm = NULL +cdef void* __nvmlVgpuTypeGetBAR1Info = NULL +cdef void* __nvmlDeviceGetActiveVgpus = NULL +cdef void* __nvmlVgpuInstanceGetVmID = NULL +cdef void* __nvmlVgpuInstanceGetUUID = NULL +cdef void* __nvmlVgpuInstanceGetVmDriverVersion = NULL +cdef void* __nvmlVgpuInstanceGetFbUsage = NULL +cdef void* __nvmlVgpuInstanceGetLicenseStatus = NULL +cdef void* __nvmlVgpuInstanceGetType = NULL +cdef void* __nvmlVgpuInstanceGetFrameRateLimit = NULL +cdef void* __nvmlVgpuInstanceGetEccMode = NULL +cdef void* __nvmlVgpuInstanceGetEncoderCapacity = NULL +cdef void* __nvmlVgpuInstanceSetEncoderCapacity = NULL +cdef void* __nvmlVgpuInstanceGetEncoderStats = NULL +cdef void* __nvmlVgpuInstanceGetEncoderSessions = NULL +cdef void* __nvmlVgpuInstanceGetFBCStats = NULL +cdef void* __nvmlVgpuInstanceGetFBCSessions = NULL +cdef void* __nvmlVgpuInstanceGetGpuInstanceId = NULL +cdef void* __nvmlVgpuInstanceGetGpuPciId = NULL +cdef void* __nvmlVgpuTypeGetCapabilities = NULL +cdef void* __nvmlVgpuInstanceGetMdevUUID = NULL +cdef void* __nvmlGpuInstanceGetCreatableVgpus = NULL +cdef void* __nvmlVgpuTypeGetMaxInstancesPerGpuInstance = NULL +cdef void* __nvmlGpuInstanceGetActiveVgpus = NULL +cdef void* __nvmlGpuInstanceSetVgpuSchedulerState = NULL +cdef void* __nvmlGpuInstanceGetVgpuSchedulerState = NULL +cdef void* __nvmlGpuInstanceGetVgpuSchedulerLog = NULL +cdef void* __nvmlGpuInstanceGetVgpuTypeCreatablePlacements = NULL +cdef void* __nvmlGpuInstanceGetVgpuHeterogeneousMode = NULL +cdef void* __nvmlGpuInstanceSetVgpuHeterogeneousMode = NULL +cdef void* __nvmlVgpuInstanceGetMetadata = NULL +cdef void* __nvmlDeviceGetVgpuMetadata = NULL +cdef void* __nvmlGetVgpuCompatibility = NULL +cdef void* __nvmlDeviceGetPgpuMetadataString = NULL +cdef void* __nvmlDeviceGetVgpuSchedulerLog = NULL +cdef void* __nvmlDeviceGetVgpuSchedulerState = NULL +cdef void* __nvmlDeviceGetVgpuSchedulerCapabilities = NULL +cdef void* __nvmlDeviceSetVgpuSchedulerState = NULL +cdef void* __nvmlGetVgpuVersion = NULL +cdef void* __nvmlSetVgpuVersion = NULL +cdef void* __nvmlDeviceGetVgpuUtilization = NULL +cdef void* __nvmlDeviceGetVgpuInstancesUtilizationInfo = NULL +cdef void* __nvmlDeviceGetVgpuProcessUtilization = NULL +cdef void* __nvmlDeviceGetVgpuProcessesUtilizationInfo = NULL +cdef void* __nvmlVgpuInstanceGetAccountingMode = NULL +cdef void* __nvmlVgpuInstanceGetAccountingPids = NULL +cdef void* __nvmlVgpuInstanceGetAccountingStats = NULL +cdef void* __nvmlVgpuInstanceClearAccountingPids = NULL +cdef void* __nvmlVgpuInstanceGetLicenseInfo_v2 = NULL +cdef void* __nvmlGetExcludedDeviceCount = NULL +cdef void* __nvmlGetExcludedDeviceInfoByIndex = NULL +cdef void* __nvmlDeviceSetMigMode = NULL +cdef void* __nvmlDeviceGetMigMode = NULL +cdef void* __nvmlDeviceGetGpuInstanceProfileInfoV = NULL +cdef void* __nvmlDeviceGetGpuInstancePossiblePlacements_v2 = NULL +cdef void* __nvmlDeviceGetGpuInstanceRemainingCapacity = NULL +cdef void* __nvmlDeviceCreateGpuInstance = NULL +cdef void* __nvmlDeviceCreateGpuInstanceWithPlacement = NULL +cdef void* __nvmlGpuInstanceDestroy = NULL +cdef void* __nvmlDeviceGetGpuInstances = NULL +cdef void* __nvmlDeviceGetGpuInstanceById = NULL +cdef void* __nvmlGpuInstanceGetInfo = NULL +cdef void* __nvmlGpuInstanceGetComputeInstanceProfileInfoV = NULL +cdef void* __nvmlGpuInstanceGetComputeInstanceRemainingCapacity = NULL +cdef void* __nvmlGpuInstanceGetComputeInstancePossiblePlacements = NULL +cdef void* __nvmlGpuInstanceCreateComputeInstance = NULL +cdef void* __nvmlGpuInstanceCreateComputeInstanceWithPlacement = NULL +cdef void* __nvmlComputeInstanceDestroy = NULL +cdef void* __nvmlGpuInstanceGetComputeInstances = NULL +cdef void* __nvmlGpuInstanceGetComputeInstanceById = NULL +cdef void* __nvmlComputeInstanceGetInfo_v2 = NULL +cdef void* __nvmlDeviceIsMigDeviceHandle = NULL +cdef void* __nvmlDeviceGetGpuInstanceId = NULL +cdef void* __nvmlDeviceGetComputeInstanceId = NULL +cdef void* __nvmlDeviceGetMaxMigDeviceCount = NULL +cdef void* __nvmlDeviceGetMigDeviceHandleByIndex = NULL +cdef void* __nvmlDeviceGetDeviceHandleFromMigDeviceHandle = NULL +cdef void* __nvmlGpmSampleGet = NULL +cdef void* __nvmlGpmMigSampleGet = NULL +cdef void* __nvmlGpmQueryDeviceSupport = NULL +cdef void* __nvmlGpmQueryIfStreamingEnabled = NULL +cdef void* __nvmlGpmSetStreamingEnabled = NULL +cdef void* __nvmlDeviceGetCapabilities = NULL +cdef void* __nvmlDeviceWorkloadPowerProfileClearRequestedProfiles = NULL +cdef void* __nvmlDevicePowerSmoothingActivatePresetProfile = NULL +cdef void* __nvmlDevicePowerSmoothingUpdatePresetProfileParam = NULL +cdef void* __nvmlDevicePowerSmoothingSetState = NULL +cdef void* __nvmlDeviceGetAddressingMode = NULL +cdef void* __nvmlDeviceGetRepairStatus = NULL +cdef void* __nvmlDeviceGetPowerMizerMode_v1 = NULL +cdef void* __nvmlDeviceSetPowerMizerMode_v1 = NULL +cdef void* __nvmlDeviceGetPdi = NULL +cdef void* __nvmlDeviceSetHostname_v1 = NULL +cdef void* __nvmlDeviceGetHostname_v1 = NULL +cdef void* __nvmlDeviceGetNvLinkInfo = NULL +cdef void* __nvmlDeviceReadWritePRM_v1 = NULL +cdef void* __nvmlDeviceGetGpuInstanceProfileInfoByIdV = NULL +cdef void* __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts = NULL + + +cdef int _check_or_init_nvml() except -1 nogil: + global __py_nvml_init + if __py_nvml_init: + return 0 + + cdef int err, driver_ver = 0 + + with gil, __symbol_lock: + # Load driver to check version + try: + handle = win32api.LoadLibraryEx("nvcuda.dll", 0, LOAD_LIBRARY_SEARCH_SYSTEM32) + except Exception as e: + raise NotSupportedError(f'CUDA driver is not found ({e})') + global __cuDriverGetVersion + if __cuDriverGetVersion == NULL: + __cuDriverGetVersion = win32api.GetProcAddress(handle, 'cuDriverGetVersion') + if __cuDriverGetVersion == NULL: + raise RuntimeError('something went wrong') + err = (__cuDriverGetVersion)(&driver_ver) + if err != 0: + raise RuntimeError('something went wrong') + + # Load library + handle = load_nvidia_dynamic_lib("nvml")._handle_uint + + # Load function + global __nvmlInit_v2 + __nvmlInit_v2 = GetProcAddress(handle, 'nvmlInit_v2') + + global __nvmlInitWithFlags + __nvmlInitWithFlags = GetProcAddress(handle, 'nvmlInitWithFlags') + + global __nvmlShutdown + __nvmlShutdown = GetProcAddress(handle, 'nvmlShutdown') + + global __nvmlErrorString + __nvmlErrorString = GetProcAddress(handle, 'nvmlErrorString') + + global __nvmlSystemGetDriverVersion + __nvmlSystemGetDriverVersion = GetProcAddress(handle, 'nvmlSystemGetDriverVersion') + + global __nvmlSystemGetNVMLVersion + __nvmlSystemGetNVMLVersion = GetProcAddress(handle, 'nvmlSystemGetNVMLVersion') + + global __nvmlSystemGetCudaDriverVersion + __nvmlSystemGetCudaDriverVersion = GetProcAddress(handle, 'nvmlSystemGetCudaDriverVersion') + + global __nvmlSystemGetCudaDriverVersion_v2 + __nvmlSystemGetCudaDriverVersion_v2 = GetProcAddress(handle, 'nvmlSystemGetCudaDriverVersion_v2') + + global __nvmlSystemGetProcessName + __nvmlSystemGetProcessName = GetProcAddress(handle, 'nvmlSystemGetProcessName') + + global __nvmlSystemGetHicVersion + __nvmlSystemGetHicVersion = GetProcAddress(handle, 'nvmlSystemGetHicVersion') + + global __nvmlSystemGetTopologyGpuSet + __nvmlSystemGetTopologyGpuSet = GetProcAddress(handle, 'nvmlSystemGetTopologyGpuSet') + + global __nvmlSystemGetDriverBranch + __nvmlSystemGetDriverBranch = GetProcAddress(handle, 'nvmlSystemGetDriverBranch') + + global __nvmlUnitGetCount + __nvmlUnitGetCount = GetProcAddress(handle, 'nvmlUnitGetCount') + + global __nvmlUnitGetHandleByIndex + __nvmlUnitGetHandleByIndex = GetProcAddress(handle, 'nvmlUnitGetHandleByIndex') + + global __nvmlUnitGetUnitInfo + __nvmlUnitGetUnitInfo = GetProcAddress(handle, 'nvmlUnitGetUnitInfo') + + global __nvmlUnitGetLedState + __nvmlUnitGetLedState = GetProcAddress(handle, 'nvmlUnitGetLedState') + + global __nvmlUnitGetPsuInfo + __nvmlUnitGetPsuInfo = GetProcAddress(handle, 'nvmlUnitGetPsuInfo') + + global __nvmlUnitGetTemperature + __nvmlUnitGetTemperature = GetProcAddress(handle, 'nvmlUnitGetTemperature') + + global __nvmlUnitGetFanSpeedInfo + __nvmlUnitGetFanSpeedInfo = GetProcAddress(handle, 'nvmlUnitGetFanSpeedInfo') + + global __nvmlUnitGetDevices + __nvmlUnitGetDevices = GetProcAddress(handle, 'nvmlUnitGetDevices') + + global __nvmlDeviceGetCount_v2 + __nvmlDeviceGetCount_v2 = GetProcAddress(handle, 'nvmlDeviceGetCount_v2') + + global __nvmlDeviceGetAttributes_v2 + __nvmlDeviceGetAttributes_v2 = GetProcAddress(handle, 'nvmlDeviceGetAttributes_v2') + + global __nvmlDeviceGetHandleByIndex_v2 + __nvmlDeviceGetHandleByIndex_v2 = GetProcAddress(handle, 'nvmlDeviceGetHandleByIndex_v2') + + global __nvmlDeviceGetHandleBySerial + __nvmlDeviceGetHandleBySerial = GetProcAddress(handle, 'nvmlDeviceGetHandleBySerial') + + global __nvmlDeviceGetHandleByUUID + __nvmlDeviceGetHandleByUUID = GetProcAddress(handle, 'nvmlDeviceGetHandleByUUID') + + global __nvmlDeviceGetHandleByUUIDV + __nvmlDeviceGetHandleByUUIDV = GetProcAddress(handle, 'nvmlDeviceGetHandleByUUIDV') + + global __nvmlDeviceGetHandleByPciBusId_v2 + __nvmlDeviceGetHandleByPciBusId_v2 = GetProcAddress(handle, 'nvmlDeviceGetHandleByPciBusId_v2') + + global __nvmlDeviceGetName + __nvmlDeviceGetName = GetProcAddress(handle, 'nvmlDeviceGetName') + + global __nvmlDeviceGetBrand + __nvmlDeviceGetBrand = GetProcAddress(handle, 'nvmlDeviceGetBrand') + + global __nvmlDeviceGetIndex + __nvmlDeviceGetIndex = GetProcAddress(handle, 'nvmlDeviceGetIndex') + + global __nvmlDeviceGetSerial + __nvmlDeviceGetSerial = GetProcAddress(handle, 'nvmlDeviceGetSerial') + + global __nvmlDeviceGetModuleId + __nvmlDeviceGetModuleId = GetProcAddress(handle, 'nvmlDeviceGetModuleId') + + global __nvmlDeviceGetC2cModeInfoV + __nvmlDeviceGetC2cModeInfoV = GetProcAddress(handle, 'nvmlDeviceGetC2cModeInfoV') + + global __nvmlDeviceGetMemoryAffinity + __nvmlDeviceGetMemoryAffinity = GetProcAddress(handle, 'nvmlDeviceGetMemoryAffinity') + + global __nvmlDeviceGetCpuAffinityWithinScope + __nvmlDeviceGetCpuAffinityWithinScope = GetProcAddress(handle, 'nvmlDeviceGetCpuAffinityWithinScope') + + global __nvmlDeviceGetCpuAffinity + __nvmlDeviceGetCpuAffinity = GetProcAddress(handle, 'nvmlDeviceGetCpuAffinity') + + global __nvmlDeviceSetCpuAffinity + __nvmlDeviceSetCpuAffinity = GetProcAddress(handle, 'nvmlDeviceSetCpuAffinity') + + global __nvmlDeviceClearCpuAffinity + __nvmlDeviceClearCpuAffinity = GetProcAddress(handle, 'nvmlDeviceClearCpuAffinity') + + global __nvmlDeviceGetNumaNodeId + __nvmlDeviceGetNumaNodeId = GetProcAddress(handle, 'nvmlDeviceGetNumaNodeId') + + global __nvmlDeviceGetTopologyCommonAncestor + __nvmlDeviceGetTopologyCommonAncestor = GetProcAddress(handle, 'nvmlDeviceGetTopologyCommonAncestor') + + global __nvmlDeviceGetTopologyNearestGpus + __nvmlDeviceGetTopologyNearestGpus = GetProcAddress(handle, 'nvmlDeviceGetTopologyNearestGpus') + + global __nvmlDeviceGetP2PStatus + __nvmlDeviceGetP2PStatus = GetProcAddress(handle, 'nvmlDeviceGetP2PStatus') + + global __nvmlDeviceGetUUID + __nvmlDeviceGetUUID = GetProcAddress(handle, 'nvmlDeviceGetUUID') + + global __nvmlDeviceGetMinorNumber + __nvmlDeviceGetMinorNumber = GetProcAddress(handle, 'nvmlDeviceGetMinorNumber') + + global __nvmlDeviceGetBoardPartNumber + __nvmlDeviceGetBoardPartNumber = GetProcAddress(handle, 'nvmlDeviceGetBoardPartNumber') + + global __nvmlDeviceGetInforomVersion + __nvmlDeviceGetInforomVersion = GetProcAddress(handle, 'nvmlDeviceGetInforomVersion') + + global __nvmlDeviceGetInforomImageVersion + __nvmlDeviceGetInforomImageVersion = GetProcAddress(handle, 'nvmlDeviceGetInforomImageVersion') + + global __nvmlDeviceGetInforomConfigurationChecksum + __nvmlDeviceGetInforomConfigurationChecksum = GetProcAddress(handle, 'nvmlDeviceGetInforomConfigurationChecksum') + + global __nvmlDeviceValidateInforom + __nvmlDeviceValidateInforom = GetProcAddress(handle, 'nvmlDeviceValidateInforom') + + global __nvmlDeviceGetLastBBXFlushTime + __nvmlDeviceGetLastBBXFlushTime = GetProcAddress(handle, 'nvmlDeviceGetLastBBXFlushTime') + + global __nvmlDeviceGetDisplayMode + __nvmlDeviceGetDisplayMode = GetProcAddress(handle, 'nvmlDeviceGetDisplayMode') + + global __nvmlDeviceGetDisplayActive + __nvmlDeviceGetDisplayActive = GetProcAddress(handle, 'nvmlDeviceGetDisplayActive') + + global __nvmlDeviceGetPersistenceMode + __nvmlDeviceGetPersistenceMode = GetProcAddress(handle, 'nvmlDeviceGetPersistenceMode') + + global __nvmlDeviceGetPciInfoExt + __nvmlDeviceGetPciInfoExt = GetProcAddress(handle, 'nvmlDeviceGetPciInfoExt') + + global __nvmlDeviceGetPciInfo_v3 + __nvmlDeviceGetPciInfo_v3 = GetProcAddress(handle, 'nvmlDeviceGetPciInfo_v3') + + global __nvmlDeviceGetMaxPcieLinkGeneration + __nvmlDeviceGetMaxPcieLinkGeneration = GetProcAddress(handle, 'nvmlDeviceGetMaxPcieLinkGeneration') + + global __nvmlDeviceGetGpuMaxPcieLinkGeneration + __nvmlDeviceGetGpuMaxPcieLinkGeneration = GetProcAddress(handle, 'nvmlDeviceGetGpuMaxPcieLinkGeneration') + + global __nvmlDeviceGetMaxPcieLinkWidth + __nvmlDeviceGetMaxPcieLinkWidth = GetProcAddress(handle, 'nvmlDeviceGetMaxPcieLinkWidth') + + global __nvmlDeviceGetCurrPcieLinkGeneration + __nvmlDeviceGetCurrPcieLinkGeneration = GetProcAddress(handle, 'nvmlDeviceGetCurrPcieLinkGeneration') + + global __nvmlDeviceGetCurrPcieLinkWidth + __nvmlDeviceGetCurrPcieLinkWidth = GetProcAddress(handle, 'nvmlDeviceGetCurrPcieLinkWidth') + + global __nvmlDeviceGetPcieThroughput + __nvmlDeviceGetPcieThroughput = GetProcAddress(handle, 'nvmlDeviceGetPcieThroughput') + + global __nvmlDeviceGetPcieReplayCounter + __nvmlDeviceGetPcieReplayCounter = GetProcAddress(handle, 'nvmlDeviceGetPcieReplayCounter') + + global __nvmlDeviceGetClockInfo + __nvmlDeviceGetClockInfo = GetProcAddress(handle, 'nvmlDeviceGetClockInfo') + + global __nvmlDeviceGetMaxClockInfo + __nvmlDeviceGetMaxClockInfo = GetProcAddress(handle, 'nvmlDeviceGetMaxClockInfo') + + global __nvmlDeviceGetGpcClkVfOffset + __nvmlDeviceGetGpcClkVfOffset = GetProcAddress(handle, 'nvmlDeviceGetGpcClkVfOffset') + + global __nvmlDeviceGetClock + __nvmlDeviceGetClock = GetProcAddress(handle, 'nvmlDeviceGetClock') + + global __nvmlDeviceGetMaxCustomerBoostClock + __nvmlDeviceGetMaxCustomerBoostClock = GetProcAddress(handle, 'nvmlDeviceGetMaxCustomerBoostClock') + + global __nvmlDeviceGetSupportedMemoryClocks + __nvmlDeviceGetSupportedMemoryClocks = GetProcAddress(handle, 'nvmlDeviceGetSupportedMemoryClocks') + + global __nvmlDeviceGetSupportedGraphicsClocks + __nvmlDeviceGetSupportedGraphicsClocks = GetProcAddress(handle, 'nvmlDeviceGetSupportedGraphicsClocks') + + global __nvmlDeviceGetAutoBoostedClocksEnabled + __nvmlDeviceGetAutoBoostedClocksEnabled = GetProcAddress(handle, 'nvmlDeviceGetAutoBoostedClocksEnabled') + + global __nvmlDeviceGetFanSpeed + __nvmlDeviceGetFanSpeed = GetProcAddress(handle, 'nvmlDeviceGetFanSpeed') + + global __nvmlDeviceGetFanSpeed_v2 + __nvmlDeviceGetFanSpeed_v2 = GetProcAddress(handle, 'nvmlDeviceGetFanSpeed_v2') + + global __nvmlDeviceGetFanSpeedRPM + __nvmlDeviceGetFanSpeedRPM = GetProcAddress(handle, 'nvmlDeviceGetFanSpeedRPM') + + global __nvmlDeviceGetTargetFanSpeed + __nvmlDeviceGetTargetFanSpeed = GetProcAddress(handle, 'nvmlDeviceGetTargetFanSpeed') + + global __nvmlDeviceGetMinMaxFanSpeed + __nvmlDeviceGetMinMaxFanSpeed = GetProcAddress(handle, 'nvmlDeviceGetMinMaxFanSpeed') + + global __nvmlDeviceGetFanControlPolicy_v2 + __nvmlDeviceGetFanControlPolicy_v2 = GetProcAddress(handle, 'nvmlDeviceGetFanControlPolicy_v2') + + global __nvmlDeviceGetNumFans + __nvmlDeviceGetNumFans = GetProcAddress(handle, 'nvmlDeviceGetNumFans') + + global __nvmlDeviceGetCoolerInfo + __nvmlDeviceGetCoolerInfo = GetProcAddress(handle, 'nvmlDeviceGetCoolerInfo') + + global __nvmlDeviceGetTemperatureV + __nvmlDeviceGetTemperatureV = GetProcAddress(handle, 'nvmlDeviceGetTemperatureV') + + global __nvmlDeviceGetTemperatureThreshold + __nvmlDeviceGetTemperatureThreshold = GetProcAddress(handle, 'nvmlDeviceGetTemperatureThreshold') + + global __nvmlDeviceGetMarginTemperature + __nvmlDeviceGetMarginTemperature = GetProcAddress(handle, 'nvmlDeviceGetMarginTemperature') + + global __nvmlDeviceGetThermalSettings + __nvmlDeviceGetThermalSettings = GetProcAddress(handle, 'nvmlDeviceGetThermalSettings') + + global __nvmlDeviceGetPerformanceState + __nvmlDeviceGetPerformanceState = GetProcAddress(handle, 'nvmlDeviceGetPerformanceState') + + global __nvmlDeviceGetCurrentClocksEventReasons + __nvmlDeviceGetCurrentClocksEventReasons = GetProcAddress(handle, 'nvmlDeviceGetCurrentClocksEventReasons') + + global __nvmlDeviceGetSupportedClocksEventReasons + __nvmlDeviceGetSupportedClocksEventReasons = GetProcAddress(handle, 'nvmlDeviceGetSupportedClocksEventReasons') + + global __nvmlDeviceGetPowerState + __nvmlDeviceGetPowerState = GetProcAddress(handle, 'nvmlDeviceGetPowerState') + + global __nvmlDeviceGetDynamicPstatesInfo + __nvmlDeviceGetDynamicPstatesInfo = GetProcAddress(handle, 'nvmlDeviceGetDynamicPstatesInfo') + + global __nvmlDeviceGetMemClkVfOffset + __nvmlDeviceGetMemClkVfOffset = GetProcAddress(handle, 'nvmlDeviceGetMemClkVfOffset') + + global __nvmlDeviceGetMinMaxClockOfPState + __nvmlDeviceGetMinMaxClockOfPState = GetProcAddress(handle, 'nvmlDeviceGetMinMaxClockOfPState') + + global __nvmlDeviceGetSupportedPerformanceStates + __nvmlDeviceGetSupportedPerformanceStates = GetProcAddress(handle, 'nvmlDeviceGetSupportedPerformanceStates') + + global __nvmlDeviceGetGpcClkMinMaxVfOffset + __nvmlDeviceGetGpcClkMinMaxVfOffset = GetProcAddress(handle, 'nvmlDeviceGetGpcClkMinMaxVfOffset') + + global __nvmlDeviceGetMemClkMinMaxVfOffset + __nvmlDeviceGetMemClkMinMaxVfOffset = GetProcAddress(handle, 'nvmlDeviceGetMemClkMinMaxVfOffset') + + global __nvmlDeviceGetClockOffsets + __nvmlDeviceGetClockOffsets = GetProcAddress(handle, 'nvmlDeviceGetClockOffsets') + + global __nvmlDeviceSetClockOffsets + __nvmlDeviceSetClockOffsets = GetProcAddress(handle, 'nvmlDeviceSetClockOffsets') + + global __nvmlDeviceGetPerformanceModes + __nvmlDeviceGetPerformanceModes = GetProcAddress(handle, 'nvmlDeviceGetPerformanceModes') + + global __nvmlDeviceGetCurrentClockFreqs + __nvmlDeviceGetCurrentClockFreqs = GetProcAddress(handle, 'nvmlDeviceGetCurrentClockFreqs') + + global __nvmlDeviceGetPowerManagementLimit + __nvmlDeviceGetPowerManagementLimit = GetProcAddress(handle, 'nvmlDeviceGetPowerManagementLimit') + + global __nvmlDeviceGetPowerManagementLimitConstraints + __nvmlDeviceGetPowerManagementLimitConstraints = GetProcAddress(handle, 'nvmlDeviceGetPowerManagementLimitConstraints') + + global __nvmlDeviceGetPowerManagementDefaultLimit + __nvmlDeviceGetPowerManagementDefaultLimit = GetProcAddress(handle, 'nvmlDeviceGetPowerManagementDefaultLimit') + + global __nvmlDeviceGetPowerUsage + __nvmlDeviceGetPowerUsage = GetProcAddress(handle, 'nvmlDeviceGetPowerUsage') + + global __nvmlDeviceGetTotalEnergyConsumption + __nvmlDeviceGetTotalEnergyConsumption = GetProcAddress(handle, 'nvmlDeviceGetTotalEnergyConsumption') + + global __nvmlDeviceGetEnforcedPowerLimit + __nvmlDeviceGetEnforcedPowerLimit = GetProcAddress(handle, 'nvmlDeviceGetEnforcedPowerLimit') + + global __nvmlDeviceGetGpuOperationMode + __nvmlDeviceGetGpuOperationMode = GetProcAddress(handle, 'nvmlDeviceGetGpuOperationMode') + + global __nvmlDeviceGetMemoryInfo_v2 + __nvmlDeviceGetMemoryInfo_v2 = GetProcAddress(handle, 'nvmlDeviceGetMemoryInfo_v2') + + global __nvmlDeviceGetComputeMode + __nvmlDeviceGetComputeMode = GetProcAddress(handle, 'nvmlDeviceGetComputeMode') + + global __nvmlDeviceGetCudaComputeCapability + __nvmlDeviceGetCudaComputeCapability = GetProcAddress(handle, 'nvmlDeviceGetCudaComputeCapability') + + global __nvmlDeviceGetDramEncryptionMode + __nvmlDeviceGetDramEncryptionMode = GetProcAddress(handle, 'nvmlDeviceGetDramEncryptionMode') + + global __nvmlDeviceSetDramEncryptionMode + __nvmlDeviceSetDramEncryptionMode = GetProcAddress(handle, 'nvmlDeviceSetDramEncryptionMode') + + global __nvmlDeviceGetEccMode + __nvmlDeviceGetEccMode = GetProcAddress(handle, 'nvmlDeviceGetEccMode') + + global __nvmlDeviceGetDefaultEccMode + __nvmlDeviceGetDefaultEccMode = GetProcAddress(handle, 'nvmlDeviceGetDefaultEccMode') + + global __nvmlDeviceGetBoardId + __nvmlDeviceGetBoardId = GetProcAddress(handle, 'nvmlDeviceGetBoardId') + + global __nvmlDeviceGetMultiGpuBoard + __nvmlDeviceGetMultiGpuBoard = GetProcAddress(handle, 'nvmlDeviceGetMultiGpuBoard') + + global __nvmlDeviceGetTotalEccErrors + __nvmlDeviceGetTotalEccErrors = GetProcAddress(handle, 'nvmlDeviceGetTotalEccErrors') + + global __nvmlDeviceGetMemoryErrorCounter + __nvmlDeviceGetMemoryErrorCounter = GetProcAddress(handle, 'nvmlDeviceGetMemoryErrorCounter') + + global __nvmlDeviceGetUtilizationRates + __nvmlDeviceGetUtilizationRates = GetProcAddress(handle, 'nvmlDeviceGetUtilizationRates') + + global __nvmlDeviceGetEncoderUtilization + __nvmlDeviceGetEncoderUtilization = GetProcAddress(handle, 'nvmlDeviceGetEncoderUtilization') + + global __nvmlDeviceGetEncoderCapacity + __nvmlDeviceGetEncoderCapacity = GetProcAddress(handle, 'nvmlDeviceGetEncoderCapacity') + + global __nvmlDeviceGetEncoderStats + __nvmlDeviceGetEncoderStats = GetProcAddress(handle, 'nvmlDeviceGetEncoderStats') + + global __nvmlDeviceGetEncoderSessions + __nvmlDeviceGetEncoderSessions = GetProcAddress(handle, 'nvmlDeviceGetEncoderSessions') + + global __nvmlDeviceGetDecoderUtilization + __nvmlDeviceGetDecoderUtilization = GetProcAddress(handle, 'nvmlDeviceGetDecoderUtilization') + + global __nvmlDeviceGetJpgUtilization + __nvmlDeviceGetJpgUtilization = GetProcAddress(handle, 'nvmlDeviceGetJpgUtilization') + + global __nvmlDeviceGetOfaUtilization + __nvmlDeviceGetOfaUtilization = GetProcAddress(handle, 'nvmlDeviceGetOfaUtilization') + + global __nvmlDeviceGetFBCStats + __nvmlDeviceGetFBCStats = GetProcAddress(handle, 'nvmlDeviceGetFBCStats') + + global __nvmlDeviceGetFBCSessions + __nvmlDeviceGetFBCSessions = GetProcAddress(handle, 'nvmlDeviceGetFBCSessions') + + global __nvmlDeviceGetDriverModel_v2 + __nvmlDeviceGetDriverModel_v2 = GetProcAddress(handle, 'nvmlDeviceGetDriverModel_v2') + + global __nvmlDeviceGetVbiosVersion + __nvmlDeviceGetVbiosVersion = GetProcAddress(handle, 'nvmlDeviceGetVbiosVersion') + + global __nvmlDeviceGetBridgeChipInfo + __nvmlDeviceGetBridgeChipInfo = GetProcAddress(handle, 'nvmlDeviceGetBridgeChipInfo') + + global __nvmlDeviceGetComputeRunningProcesses_v3 + __nvmlDeviceGetComputeRunningProcesses_v3 = GetProcAddress(handle, 'nvmlDeviceGetComputeRunningProcesses_v3') + + global __nvmlDeviceGetGraphicsRunningProcesses_v3 + __nvmlDeviceGetGraphicsRunningProcesses_v3 = GetProcAddress(handle, 'nvmlDeviceGetGraphicsRunningProcesses_v3') + + global __nvmlDeviceGetMPSComputeRunningProcesses_v3 + __nvmlDeviceGetMPSComputeRunningProcesses_v3 = GetProcAddress(handle, 'nvmlDeviceGetMPSComputeRunningProcesses_v3') + + global __nvmlDeviceGetRunningProcessDetailList + __nvmlDeviceGetRunningProcessDetailList = GetProcAddress(handle, 'nvmlDeviceGetRunningProcessDetailList') + + global __nvmlDeviceOnSameBoard + __nvmlDeviceOnSameBoard = GetProcAddress(handle, 'nvmlDeviceOnSameBoard') + + global __nvmlDeviceGetAPIRestriction + __nvmlDeviceGetAPIRestriction = GetProcAddress(handle, 'nvmlDeviceGetAPIRestriction') + + global __nvmlDeviceGetSamples + __nvmlDeviceGetSamples = GetProcAddress(handle, 'nvmlDeviceGetSamples') + + global __nvmlDeviceGetBAR1MemoryInfo + __nvmlDeviceGetBAR1MemoryInfo = GetProcAddress(handle, 'nvmlDeviceGetBAR1MemoryInfo') + + global __nvmlDeviceGetIrqNum + __nvmlDeviceGetIrqNum = GetProcAddress(handle, 'nvmlDeviceGetIrqNum') + + global __nvmlDeviceGetNumGpuCores + __nvmlDeviceGetNumGpuCores = GetProcAddress(handle, 'nvmlDeviceGetNumGpuCores') + + global __nvmlDeviceGetPowerSource + __nvmlDeviceGetPowerSource = GetProcAddress(handle, 'nvmlDeviceGetPowerSource') + + global __nvmlDeviceGetMemoryBusWidth + __nvmlDeviceGetMemoryBusWidth = GetProcAddress(handle, 'nvmlDeviceGetMemoryBusWidth') + + global __nvmlDeviceGetPcieLinkMaxSpeed + __nvmlDeviceGetPcieLinkMaxSpeed = GetProcAddress(handle, 'nvmlDeviceGetPcieLinkMaxSpeed') + + global __nvmlDeviceGetPcieSpeed + __nvmlDeviceGetPcieSpeed = GetProcAddress(handle, 'nvmlDeviceGetPcieSpeed') + + global __nvmlDeviceGetAdaptiveClockInfoStatus + __nvmlDeviceGetAdaptiveClockInfoStatus = GetProcAddress(handle, 'nvmlDeviceGetAdaptiveClockInfoStatus') + + global __nvmlDeviceGetBusType + __nvmlDeviceGetBusType = GetProcAddress(handle, 'nvmlDeviceGetBusType') + + global __nvmlDeviceGetGpuFabricInfoV + __nvmlDeviceGetGpuFabricInfoV = GetProcAddress(handle, 'nvmlDeviceGetGpuFabricInfoV') + + global __nvmlSystemGetConfComputeCapabilities + __nvmlSystemGetConfComputeCapabilities = GetProcAddress(handle, 'nvmlSystemGetConfComputeCapabilities') + + global __nvmlSystemGetConfComputeState + __nvmlSystemGetConfComputeState = GetProcAddress(handle, 'nvmlSystemGetConfComputeState') + + global __nvmlDeviceGetConfComputeMemSizeInfo + __nvmlDeviceGetConfComputeMemSizeInfo = GetProcAddress(handle, 'nvmlDeviceGetConfComputeMemSizeInfo') + + global __nvmlSystemGetConfComputeGpusReadyState + __nvmlSystemGetConfComputeGpusReadyState = GetProcAddress(handle, 'nvmlSystemGetConfComputeGpusReadyState') + + global __nvmlDeviceGetConfComputeProtectedMemoryUsage + __nvmlDeviceGetConfComputeProtectedMemoryUsage = GetProcAddress(handle, 'nvmlDeviceGetConfComputeProtectedMemoryUsage') + + global __nvmlDeviceGetConfComputeGpuCertificate + __nvmlDeviceGetConfComputeGpuCertificate = GetProcAddress(handle, 'nvmlDeviceGetConfComputeGpuCertificate') + + global __nvmlDeviceGetConfComputeGpuAttestationReport + __nvmlDeviceGetConfComputeGpuAttestationReport = GetProcAddress(handle, 'nvmlDeviceGetConfComputeGpuAttestationReport') + + global __nvmlSystemGetConfComputeKeyRotationThresholdInfo + __nvmlSystemGetConfComputeKeyRotationThresholdInfo = GetProcAddress(handle, 'nvmlSystemGetConfComputeKeyRotationThresholdInfo') + + global __nvmlDeviceSetConfComputeUnprotectedMemSize + __nvmlDeviceSetConfComputeUnprotectedMemSize = GetProcAddress(handle, 'nvmlDeviceSetConfComputeUnprotectedMemSize') + + global __nvmlSystemSetConfComputeGpusReadyState + __nvmlSystemSetConfComputeGpusReadyState = GetProcAddress(handle, 'nvmlSystemSetConfComputeGpusReadyState') + + global __nvmlSystemSetConfComputeKeyRotationThresholdInfo + __nvmlSystemSetConfComputeKeyRotationThresholdInfo = GetProcAddress(handle, 'nvmlSystemSetConfComputeKeyRotationThresholdInfo') + + global __nvmlSystemGetConfComputeSettings + __nvmlSystemGetConfComputeSettings = GetProcAddress(handle, 'nvmlSystemGetConfComputeSettings') + + global __nvmlDeviceGetGspFirmwareVersion + __nvmlDeviceGetGspFirmwareVersion = GetProcAddress(handle, 'nvmlDeviceGetGspFirmwareVersion') + + global __nvmlDeviceGetGspFirmwareMode + __nvmlDeviceGetGspFirmwareMode = GetProcAddress(handle, 'nvmlDeviceGetGspFirmwareMode') + + global __nvmlDeviceGetSramEccErrorStatus + __nvmlDeviceGetSramEccErrorStatus = GetProcAddress(handle, 'nvmlDeviceGetSramEccErrorStatus') + + global __nvmlDeviceGetAccountingMode + __nvmlDeviceGetAccountingMode = GetProcAddress(handle, 'nvmlDeviceGetAccountingMode') + + global __nvmlDeviceGetAccountingStats + __nvmlDeviceGetAccountingStats = GetProcAddress(handle, 'nvmlDeviceGetAccountingStats') + + global __nvmlDeviceGetAccountingPids + __nvmlDeviceGetAccountingPids = GetProcAddress(handle, 'nvmlDeviceGetAccountingPids') + + global __nvmlDeviceGetAccountingBufferSize + __nvmlDeviceGetAccountingBufferSize = GetProcAddress(handle, 'nvmlDeviceGetAccountingBufferSize') + + global __nvmlDeviceGetRetiredPages + __nvmlDeviceGetRetiredPages = GetProcAddress(handle, 'nvmlDeviceGetRetiredPages') + + global __nvmlDeviceGetRetiredPages_v2 + __nvmlDeviceGetRetiredPages_v2 = GetProcAddress(handle, 'nvmlDeviceGetRetiredPages_v2') + + global __nvmlDeviceGetRetiredPagesPendingStatus + __nvmlDeviceGetRetiredPagesPendingStatus = GetProcAddress(handle, 'nvmlDeviceGetRetiredPagesPendingStatus') + + global __nvmlDeviceGetRemappedRows + __nvmlDeviceGetRemappedRows = GetProcAddress(handle, 'nvmlDeviceGetRemappedRows') + + global __nvmlDeviceGetRowRemapperHistogram + __nvmlDeviceGetRowRemapperHistogram = GetProcAddress(handle, 'nvmlDeviceGetRowRemapperHistogram') + + global __nvmlDeviceGetArchitecture + __nvmlDeviceGetArchitecture = GetProcAddress(handle, 'nvmlDeviceGetArchitecture') + + global __nvmlDeviceGetClkMonStatus + __nvmlDeviceGetClkMonStatus = GetProcAddress(handle, 'nvmlDeviceGetClkMonStatus') + + global __nvmlDeviceGetProcessUtilization + __nvmlDeviceGetProcessUtilization = GetProcAddress(handle, 'nvmlDeviceGetProcessUtilization') + + global __nvmlDeviceGetProcessesUtilizationInfo + __nvmlDeviceGetProcessesUtilizationInfo = GetProcAddress(handle, 'nvmlDeviceGetProcessesUtilizationInfo') + + global __nvmlDeviceGetPlatformInfo + __nvmlDeviceGetPlatformInfo = GetProcAddress(handle, 'nvmlDeviceGetPlatformInfo') + + global __nvmlUnitSetLedState + __nvmlUnitSetLedState = GetProcAddress(handle, 'nvmlUnitSetLedState') + + global __nvmlDeviceSetPersistenceMode + __nvmlDeviceSetPersistenceMode = GetProcAddress(handle, 'nvmlDeviceSetPersistenceMode') + + global __nvmlDeviceSetComputeMode + __nvmlDeviceSetComputeMode = GetProcAddress(handle, 'nvmlDeviceSetComputeMode') + + global __nvmlDeviceSetEccMode + __nvmlDeviceSetEccMode = GetProcAddress(handle, 'nvmlDeviceSetEccMode') + + global __nvmlDeviceClearEccErrorCounts + __nvmlDeviceClearEccErrorCounts = GetProcAddress(handle, 'nvmlDeviceClearEccErrorCounts') + + global __nvmlDeviceSetDriverModel + __nvmlDeviceSetDriverModel = GetProcAddress(handle, 'nvmlDeviceSetDriverModel') + + global __nvmlDeviceSetGpuLockedClocks + __nvmlDeviceSetGpuLockedClocks = GetProcAddress(handle, 'nvmlDeviceSetGpuLockedClocks') + + global __nvmlDeviceResetGpuLockedClocks + __nvmlDeviceResetGpuLockedClocks = GetProcAddress(handle, 'nvmlDeviceResetGpuLockedClocks') + + global __nvmlDeviceSetMemoryLockedClocks + __nvmlDeviceSetMemoryLockedClocks = GetProcAddress(handle, 'nvmlDeviceSetMemoryLockedClocks') + + global __nvmlDeviceResetMemoryLockedClocks + __nvmlDeviceResetMemoryLockedClocks = GetProcAddress(handle, 'nvmlDeviceResetMemoryLockedClocks') + + global __nvmlDeviceSetAutoBoostedClocksEnabled + __nvmlDeviceSetAutoBoostedClocksEnabled = GetProcAddress(handle, 'nvmlDeviceSetAutoBoostedClocksEnabled') + + global __nvmlDeviceSetDefaultAutoBoostedClocksEnabled + __nvmlDeviceSetDefaultAutoBoostedClocksEnabled = GetProcAddress(handle, 'nvmlDeviceSetDefaultAutoBoostedClocksEnabled') + + global __nvmlDeviceSetDefaultFanSpeed_v2 + __nvmlDeviceSetDefaultFanSpeed_v2 = GetProcAddress(handle, 'nvmlDeviceSetDefaultFanSpeed_v2') + + global __nvmlDeviceSetFanControlPolicy + __nvmlDeviceSetFanControlPolicy = GetProcAddress(handle, 'nvmlDeviceSetFanControlPolicy') + + global __nvmlDeviceSetTemperatureThreshold + __nvmlDeviceSetTemperatureThreshold = GetProcAddress(handle, 'nvmlDeviceSetTemperatureThreshold') + + global __nvmlDeviceSetPowerManagementLimit + __nvmlDeviceSetPowerManagementLimit = GetProcAddress(handle, 'nvmlDeviceSetPowerManagementLimit') + + global __nvmlDeviceSetGpuOperationMode + __nvmlDeviceSetGpuOperationMode = GetProcAddress(handle, 'nvmlDeviceSetGpuOperationMode') + + global __nvmlDeviceSetAPIRestriction + __nvmlDeviceSetAPIRestriction = GetProcAddress(handle, 'nvmlDeviceSetAPIRestriction') + + global __nvmlDeviceSetFanSpeed_v2 + __nvmlDeviceSetFanSpeed_v2 = GetProcAddress(handle, 'nvmlDeviceSetFanSpeed_v2') + + global __nvmlDeviceSetAccountingMode + __nvmlDeviceSetAccountingMode = GetProcAddress(handle, 'nvmlDeviceSetAccountingMode') + + global __nvmlDeviceClearAccountingPids + __nvmlDeviceClearAccountingPids = GetProcAddress(handle, 'nvmlDeviceClearAccountingPids') + + global __nvmlDeviceSetPowerManagementLimit_v2 + __nvmlDeviceSetPowerManagementLimit_v2 = GetProcAddress(handle, 'nvmlDeviceSetPowerManagementLimit_v2') + + global __nvmlDeviceGetNvLinkState + __nvmlDeviceGetNvLinkState = GetProcAddress(handle, 'nvmlDeviceGetNvLinkState') + + global __nvmlDeviceGetNvLinkVersion + __nvmlDeviceGetNvLinkVersion = GetProcAddress(handle, 'nvmlDeviceGetNvLinkVersion') + + global __nvmlDeviceGetNvLinkCapability + __nvmlDeviceGetNvLinkCapability = GetProcAddress(handle, 'nvmlDeviceGetNvLinkCapability') + + global __nvmlDeviceGetNvLinkRemotePciInfo_v2 + __nvmlDeviceGetNvLinkRemotePciInfo_v2 = GetProcAddress(handle, 'nvmlDeviceGetNvLinkRemotePciInfo_v2') + + global __nvmlDeviceGetNvLinkErrorCounter + __nvmlDeviceGetNvLinkErrorCounter = GetProcAddress(handle, 'nvmlDeviceGetNvLinkErrorCounter') + + global __nvmlDeviceResetNvLinkErrorCounters + __nvmlDeviceResetNvLinkErrorCounters = GetProcAddress(handle, 'nvmlDeviceResetNvLinkErrorCounters') + + global __nvmlDeviceGetNvLinkRemoteDeviceType + __nvmlDeviceGetNvLinkRemoteDeviceType = GetProcAddress(handle, 'nvmlDeviceGetNvLinkRemoteDeviceType') + + global __nvmlDeviceSetNvLinkDeviceLowPowerThreshold + __nvmlDeviceSetNvLinkDeviceLowPowerThreshold = GetProcAddress(handle, 'nvmlDeviceSetNvLinkDeviceLowPowerThreshold') + + global __nvmlSystemSetNvlinkBwMode + __nvmlSystemSetNvlinkBwMode = GetProcAddress(handle, 'nvmlSystemSetNvlinkBwMode') + + global __nvmlSystemGetNvlinkBwMode + __nvmlSystemGetNvlinkBwMode = GetProcAddress(handle, 'nvmlSystemGetNvlinkBwMode') + + global __nvmlDeviceGetNvlinkSupportedBwModes + __nvmlDeviceGetNvlinkSupportedBwModes = GetProcAddress(handle, 'nvmlDeviceGetNvlinkSupportedBwModes') + + global __nvmlDeviceGetNvlinkBwMode + __nvmlDeviceGetNvlinkBwMode = GetProcAddress(handle, 'nvmlDeviceGetNvlinkBwMode') + + global __nvmlDeviceSetNvlinkBwMode + __nvmlDeviceSetNvlinkBwMode = GetProcAddress(handle, 'nvmlDeviceSetNvlinkBwMode') + + global __nvmlEventSetCreate + __nvmlEventSetCreate = GetProcAddress(handle, 'nvmlEventSetCreate') + + global __nvmlDeviceRegisterEvents + __nvmlDeviceRegisterEvents = GetProcAddress(handle, 'nvmlDeviceRegisterEvents') + + global __nvmlDeviceGetSupportedEventTypes + __nvmlDeviceGetSupportedEventTypes = GetProcAddress(handle, 'nvmlDeviceGetSupportedEventTypes') + + global __nvmlEventSetWait_v2 + __nvmlEventSetWait_v2 = GetProcAddress(handle, 'nvmlEventSetWait_v2') + + global __nvmlEventSetFree + __nvmlEventSetFree = GetProcAddress(handle, 'nvmlEventSetFree') + + global __nvmlSystemEventSetCreate + __nvmlSystemEventSetCreate = GetProcAddress(handle, 'nvmlSystemEventSetCreate') + + global __nvmlSystemEventSetFree + __nvmlSystemEventSetFree = GetProcAddress(handle, 'nvmlSystemEventSetFree') + + global __nvmlSystemRegisterEvents + __nvmlSystemRegisterEvents = GetProcAddress(handle, 'nvmlSystemRegisterEvents') + + global __nvmlSystemEventSetWait + __nvmlSystemEventSetWait = GetProcAddress(handle, 'nvmlSystemEventSetWait') + + global __nvmlDeviceModifyDrainState + __nvmlDeviceModifyDrainState = GetProcAddress(handle, 'nvmlDeviceModifyDrainState') + + global __nvmlDeviceQueryDrainState + __nvmlDeviceQueryDrainState = GetProcAddress(handle, 'nvmlDeviceQueryDrainState') + + global __nvmlDeviceRemoveGpu_v2 + __nvmlDeviceRemoveGpu_v2 = GetProcAddress(handle, 'nvmlDeviceRemoveGpu_v2') + + global __nvmlDeviceDiscoverGpus + __nvmlDeviceDiscoverGpus = GetProcAddress(handle, 'nvmlDeviceDiscoverGpus') + + global __nvmlDeviceGetFieldValues + __nvmlDeviceGetFieldValues = GetProcAddress(handle, 'nvmlDeviceGetFieldValues') + + global __nvmlDeviceClearFieldValues + __nvmlDeviceClearFieldValues = GetProcAddress(handle, 'nvmlDeviceClearFieldValues') + + global __nvmlDeviceGetVirtualizationMode + __nvmlDeviceGetVirtualizationMode = GetProcAddress(handle, 'nvmlDeviceGetVirtualizationMode') + + global __nvmlDeviceGetHostVgpuMode + __nvmlDeviceGetHostVgpuMode = GetProcAddress(handle, 'nvmlDeviceGetHostVgpuMode') + + global __nvmlDeviceSetVirtualizationMode + __nvmlDeviceSetVirtualizationMode = GetProcAddress(handle, 'nvmlDeviceSetVirtualizationMode') + + global __nvmlDeviceGetVgpuHeterogeneousMode + __nvmlDeviceGetVgpuHeterogeneousMode = GetProcAddress(handle, 'nvmlDeviceGetVgpuHeterogeneousMode') + + global __nvmlDeviceSetVgpuHeterogeneousMode + __nvmlDeviceSetVgpuHeterogeneousMode = GetProcAddress(handle, 'nvmlDeviceSetVgpuHeterogeneousMode') + + global __nvmlVgpuInstanceGetPlacementId + __nvmlVgpuInstanceGetPlacementId = GetProcAddress(handle, 'nvmlVgpuInstanceGetPlacementId') + + global __nvmlDeviceGetVgpuTypeSupportedPlacements + __nvmlDeviceGetVgpuTypeSupportedPlacements = GetProcAddress(handle, 'nvmlDeviceGetVgpuTypeSupportedPlacements') + + global __nvmlDeviceGetVgpuTypeCreatablePlacements + __nvmlDeviceGetVgpuTypeCreatablePlacements = GetProcAddress(handle, 'nvmlDeviceGetVgpuTypeCreatablePlacements') + + global __nvmlVgpuTypeGetGspHeapSize + __nvmlVgpuTypeGetGspHeapSize = GetProcAddress(handle, 'nvmlVgpuTypeGetGspHeapSize') + + global __nvmlVgpuTypeGetFbReservation + __nvmlVgpuTypeGetFbReservation = GetProcAddress(handle, 'nvmlVgpuTypeGetFbReservation') + + global __nvmlVgpuInstanceGetRuntimeStateSize + __nvmlVgpuInstanceGetRuntimeStateSize = GetProcAddress(handle, 'nvmlVgpuInstanceGetRuntimeStateSize') + + global __nvmlDeviceSetVgpuCapabilities + __nvmlDeviceSetVgpuCapabilities = GetProcAddress(handle, 'nvmlDeviceSetVgpuCapabilities') + + global __nvmlDeviceGetGridLicensableFeatures_v4 + __nvmlDeviceGetGridLicensableFeatures_v4 = GetProcAddress(handle, 'nvmlDeviceGetGridLicensableFeatures_v4') + + global __nvmlGetVgpuDriverCapabilities + __nvmlGetVgpuDriverCapabilities = GetProcAddress(handle, 'nvmlGetVgpuDriverCapabilities') + + global __nvmlDeviceGetVgpuCapabilities + __nvmlDeviceGetVgpuCapabilities = GetProcAddress(handle, 'nvmlDeviceGetVgpuCapabilities') + + global __nvmlDeviceGetSupportedVgpus + __nvmlDeviceGetSupportedVgpus = GetProcAddress(handle, 'nvmlDeviceGetSupportedVgpus') + + global __nvmlDeviceGetCreatableVgpus + __nvmlDeviceGetCreatableVgpus = GetProcAddress(handle, 'nvmlDeviceGetCreatableVgpus') + + global __nvmlVgpuTypeGetClass + __nvmlVgpuTypeGetClass = GetProcAddress(handle, 'nvmlVgpuTypeGetClass') + + global __nvmlVgpuTypeGetName + __nvmlVgpuTypeGetName = GetProcAddress(handle, 'nvmlVgpuTypeGetName') + + global __nvmlVgpuTypeGetGpuInstanceProfileId + __nvmlVgpuTypeGetGpuInstanceProfileId = GetProcAddress(handle, 'nvmlVgpuTypeGetGpuInstanceProfileId') + + global __nvmlVgpuTypeGetDeviceID + __nvmlVgpuTypeGetDeviceID = GetProcAddress(handle, 'nvmlVgpuTypeGetDeviceID') + + global __nvmlVgpuTypeGetFramebufferSize + __nvmlVgpuTypeGetFramebufferSize = GetProcAddress(handle, 'nvmlVgpuTypeGetFramebufferSize') + + global __nvmlVgpuTypeGetNumDisplayHeads + __nvmlVgpuTypeGetNumDisplayHeads = GetProcAddress(handle, 'nvmlVgpuTypeGetNumDisplayHeads') + + global __nvmlVgpuTypeGetResolution + __nvmlVgpuTypeGetResolution = GetProcAddress(handle, 'nvmlVgpuTypeGetResolution') + + global __nvmlVgpuTypeGetLicense + __nvmlVgpuTypeGetLicense = GetProcAddress(handle, 'nvmlVgpuTypeGetLicense') + + global __nvmlVgpuTypeGetFrameRateLimit + __nvmlVgpuTypeGetFrameRateLimit = GetProcAddress(handle, 'nvmlVgpuTypeGetFrameRateLimit') + + global __nvmlVgpuTypeGetMaxInstances + __nvmlVgpuTypeGetMaxInstances = GetProcAddress(handle, 'nvmlVgpuTypeGetMaxInstances') + + global __nvmlVgpuTypeGetMaxInstancesPerVm + __nvmlVgpuTypeGetMaxInstancesPerVm = GetProcAddress(handle, 'nvmlVgpuTypeGetMaxInstancesPerVm') + + global __nvmlVgpuTypeGetBAR1Info + __nvmlVgpuTypeGetBAR1Info = GetProcAddress(handle, 'nvmlVgpuTypeGetBAR1Info') + + global __nvmlDeviceGetActiveVgpus + __nvmlDeviceGetActiveVgpus = GetProcAddress(handle, 'nvmlDeviceGetActiveVgpus') + + global __nvmlVgpuInstanceGetVmID + __nvmlVgpuInstanceGetVmID = GetProcAddress(handle, 'nvmlVgpuInstanceGetVmID') + + global __nvmlVgpuInstanceGetUUID + __nvmlVgpuInstanceGetUUID = GetProcAddress(handle, 'nvmlVgpuInstanceGetUUID') + + global __nvmlVgpuInstanceGetVmDriverVersion + __nvmlVgpuInstanceGetVmDriverVersion = GetProcAddress(handle, 'nvmlVgpuInstanceGetVmDriverVersion') + + global __nvmlVgpuInstanceGetFbUsage + __nvmlVgpuInstanceGetFbUsage = GetProcAddress(handle, 'nvmlVgpuInstanceGetFbUsage') + + global __nvmlVgpuInstanceGetLicenseStatus + __nvmlVgpuInstanceGetLicenseStatus = GetProcAddress(handle, 'nvmlVgpuInstanceGetLicenseStatus') + + global __nvmlVgpuInstanceGetType + __nvmlVgpuInstanceGetType = GetProcAddress(handle, 'nvmlVgpuInstanceGetType') + + global __nvmlVgpuInstanceGetFrameRateLimit + __nvmlVgpuInstanceGetFrameRateLimit = GetProcAddress(handle, 'nvmlVgpuInstanceGetFrameRateLimit') + + global __nvmlVgpuInstanceGetEccMode + __nvmlVgpuInstanceGetEccMode = GetProcAddress(handle, 'nvmlVgpuInstanceGetEccMode') + + global __nvmlVgpuInstanceGetEncoderCapacity + __nvmlVgpuInstanceGetEncoderCapacity = GetProcAddress(handle, 'nvmlVgpuInstanceGetEncoderCapacity') + + global __nvmlVgpuInstanceSetEncoderCapacity + __nvmlVgpuInstanceSetEncoderCapacity = GetProcAddress(handle, 'nvmlVgpuInstanceSetEncoderCapacity') + + global __nvmlVgpuInstanceGetEncoderStats + __nvmlVgpuInstanceGetEncoderStats = GetProcAddress(handle, 'nvmlVgpuInstanceGetEncoderStats') + + global __nvmlVgpuInstanceGetEncoderSessions + __nvmlVgpuInstanceGetEncoderSessions = GetProcAddress(handle, 'nvmlVgpuInstanceGetEncoderSessions') + + global __nvmlVgpuInstanceGetFBCStats + __nvmlVgpuInstanceGetFBCStats = GetProcAddress(handle, 'nvmlVgpuInstanceGetFBCStats') + + global __nvmlVgpuInstanceGetFBCSessions + __nvmlVgpuInstanceGetFBCSessions = GetProcAddress(handle, 'nvmlVgpuInstanceGetFBCSessions') + + global __nvmlVgpuInstanceGetGpuInstanceId + __nvmlVgpuInstanceGetGpuInstanceId = GetProcAddress(handle, 'nvmlVgpuInstanceGetGpuInstanceId') + + global __nvmlVgpuInstanceGetGpuPciId + __nvmlVgpuInstanceGetGpuPciId = GetProcAddress(handle, 'nvmlVgpuInstanceGetGpuPciId') + + global __nvmlVgpuTypeGetCapabilities + __nvmlVgpuTypeGetCapabilities = GetProcAddress(handle, 'nvmlVgpuTypeGetCapabilities') + + global __nvmlVgpuInstanceGetMdevUUID + __nvmlVgpuInstanceGetMdevUUID = GetProcAddress(handle, 'nvmlVgpuInstanceGetMdevUUID') + + global __nvmlGpuInstanceGetCreatableVgpus + __nvmlGpuInstanceGetCreatableVgpus = GetProcAddress(handle, 'nvmlGpuInstanceGetCreatableVgpus') + + global __nvmlVgpuTypeGetMaxInstancesPerGpuInstance + __nvmlVgpuTypeGetMaxInstancesPerGpuInstance = GetProcAddress(handle, 'nvmlVgpuTypeGetMaxInstancesPerGpuInstance') + + global __nvmlGpuInstanceGetActiveVgpus + __nvmlGpuInstanceGetActiveVgpus = GetProcAddress(handle, 'nvmlGpuInstanceGetActiveVgpus') + + global __nvmlGpuInstanceSetVgpuSchedulerState + __nvmlGpuInstanceSetVgpuSchedulerState = GetProcAddress(handle, 'nvmlGpuInstanceSetVgpuSchedulerState') + + global __nvmlGpuInstanceGetVgpuSchedulerState + __nvmlGpuInstanceGetVgpuSchedulerState = GetProcAddress(handle, 'nvmlGpuInstanceGetVgpuSchedulerState') + + global __nvmlGpuInstanceGetVgpuSchedulerLog + __nvmlGpuInstanceGetVgpuSchedulerLog = GetProcAddress(handle, 'nvmlGpuInstanceGetVgpuSchedulerLog') + + global __nvmlGpuInstanceGetVgpuTypeCreatablePlacements + __nvmlGpuInstanceGetVgpuTypeCreatablePlacements = GetProcAddress(handle, 'nvmlGpuInstanceGetVgpuTypeCreatablePlacements') + + global __nvmlGpuInstanceGetVgpuHeterogeneousMode + __nvmlGpuInstanceGetVgpuHeterogeneousMode = GetProcAddress(handle, 'nvmlGpuInstanceGetVgpuHeterogeneousMode') + + global __nvmlGpuInstanceSetVgpuHeterogeneousMode + __nvmlGpuInstanceSetVgpuHeterogeneousMode = GetProcAddress(handle, 'nvmlGpuInstanceSetVgpuHeterogeneousMode') + + global __nvmlVgpuInstanceGetMetadata + __nvmlVgpuInstanceGetMetadata = GetProcAddress(handle, 'nvmlVgpuInstanceGetMetadata') + + global __nvmlDeviceGetVgpuMetadata + __nvmlDeviceGetVgpuMetadata = GetProcAddress(handle, 'nvmlDeviceGetVgpuMetadata') + + global __nvmlGetVgpuCompatibility + __nvmlGetVgpuCompatibility = GetProcAddress(handle, 'nvmlGetVgpuCompatibility') + + global __nvmlDeviceGetPgpuMetadataString + __nvmlDeviceGetPgpuMetadataString = GetProcAddress(handle, 'nvmlDeviceGetPgpuMetadataString') + + global __nvmlDeviceGetVgpuSchedulerLog + __nvmlDeviceGetVgpuSchedulerLog = GetProcAddress(handle, 'nvmlDeviceGetVgpuSchedulerLog') + + global __nvmlDeviceGetVgpuSchedulerState + __nvmlDeviceGetVgpuSchedulerState = GetProcAddress(handle, 'nvmlDeviceGetVgpuSchedulerState') + + global __nvmlDeviceGetVgpuSchedulerCapabilities + __nvmlDeviceGetVgpuSchedulerCapabilities = GetProcAddress(handle, 'nvmlDeviceGetVgpuSchedulerCapabilities') + + global __nvmlDeviceSetVgpuSchedulerState + __nvmlDeviceSetVgpuSchedulerState = GetProcAddress(handle, 'nvmlDeviceSetVgpuSchedulerState') + + global __nvmlGetVgpuVersion + __nvmlGetVgpuVersion = GetProcAddress(handle, 'nvmlGetVgpuVersion') + + global __nvmlSetVgpuVersion + __nvmlSetVgpuVersion = GetProcAddress(handle, 'nvmlSetVgpuVersion') + + global __nvmlDeviceGetVgpuUtilization + __nvmlDeviceGetVgpuUtilization = GetProcAddress(handle, 'nvmlDeviceGetVgpuUtilization') + + global __nvmlDeviceGetVgpuInstancesUtilizationInfo + __nvmlDeviceGetVgpuInstancesUtilizationInfo = GetProcAddress(handle, 'nvmlDeviceGetVgpuInstancesUtilizationInfo') + + global __nvmlDeviceGetVgpuProcessUtilization + __nvmlDeviceGetVgpuProcessUtilization = GetProcAddress(handle, 'nvmlDeviceGetVgpuProcessUtilization') + + global __nvmlDeviceGetVgpuProcessesUtilizationInfo + __nvmlDeviceGetVgpuProcessesUtilizationInfo = GetProcAddress(handle, 'nvmlDeviceGetVgpuProcessesUtilizationInfo') + + global __nvmlVgpuInstanceGetAccountingMode + __nvmlVgpuInstanceGetAccountingMode = GetProcAddress(handle, 'nvmlVgpuInstanceGetAccountingMode') + + global __nvmlVgpuInstanceGetAccountingPids + __nvmlVgpuInstanceGetAccountingPids = GetProcAddress(handle, 'nvmlVgpuInstanceGetAccountingPids') + + global __nvmlVgpuInstanceGetAccountingStats + __nvmlVgpuInstanceGetAccountingStats = GetProcAddress(handle, 'nvmlVgpuInstanceGetAccountingStats') + + global __nvmlVgpuInstanceClearAccountingPids + __nvmlVgpuInstanceClearAccountingPids = GetProcAddress(handle, 'nvmlVgpuInstanceClearAccountingPids') + + global __nvmlVgpuInstanceGetLicenseInfo_v2 + __nvmlVgpuInstanceGetLicenseInfo_v2 = GetProcAddress(handle, 'nvmlVgpuInstanceGetLicenseInfo_v2') + + global __nvmlGetExcludedDeviceCount + __nvmlGetExcludedDeviceCount = GetProcAddress(handle, 'nvmlGetExcludedDeviceCount') + + global __nvmlGetExcludedDeviceInfoByIndex + __nvmlGetExcludedDeviceInfoByIndex = GetProcAddress(handle, 'nvmlGetExcludedDeviceInfoByIndex') + + global __nvmlDeviceSetMigMode + __nvmlDeviceSetMigMode = GetProcAddress(handle, 'nvmlDeviceSetMigMode') + + global __nvmlDeviceGetMigMode + __nvmlDeviceGetMigMode = GetProcAddress(handle, 'nvmlDeviceGetMigMode') + + global __nvmlDeviceGetGpuInstanceProfileInfoV + __nvmlDeviceGetGpuInstanceProfileInfoV = GetProcAddress(handle, 'nvmlDeviceGetGpuInstanceProfileInfoV') + + global __nvmlDeviceGetGpuInstancePossiblePlacements_v2 + __nvmlDeviceGetGpuInstancePossiblePlacements_v2 = GetProcAddress(handle, 'nvmlDeviceGetGpuInstancePossiblePlacements_v2') + + global __nvmlDeviceGetGpuInstanceRemainingCapacity + __nvmlDeviceGetGpuInstanceRemainingCapacity = GetProcAddress(handle, 'nvmlDeviceGetGpuInstanceRemainingCapacity') + + global __nvmlDeviceCreateGpuInstance + __nvmlDeviceCreateGpuInstance = GetProcAddress(handle, 'nvmlDeviceCreateGpuInstance') + + global __nvmlDeviceCreateGpuInstanceWithPlacement + __nvmlDeviceCreateGpuInstanceWithPlacement = GetProcAddress(handle, 'nvmlDeviceCreateGpuInstanceWithPlacement') + + global __nvmlGpuInstanceDestroy + __nvmlGpuInstanceDestroy = GetProcAddress(handle, 'nvmlGpuInstanceDestroy') + + global __nvmlDeviceGetGpuInstances + __nvmlDeviceGetGpuInstances = GetProcAddress(handle, 'nvmlDeviceGetGpuInstances') + + global __nvmlDeviceGetGpuInstanceById + __nvmlDeviceGetGpuInstanceById = GetProcAddress(handle, 'nvmlDeviceGetGpuInstanceById') + + global __nvmlGpuInstanceGetInfo + __nvmlGpuInstanceGetInfo = GetProcAddress(handle, 'nvmlGpuInstanceGetInfo') + + global __nvmlGpuInstanceGetComputeInstanceProfileInfoV + __nvmlGpuInstanceGetComputeInstanceProfileInfoV = GetProcAddress(handle, 'nvmlGpuInstanceGetComputeInstanceProfileInfoV') + + global __nvmlGpuInstanceGetComputeInstanceRemainingCapacity + __nvmlGpuInstanceGetComputeInstanceRemainingCapacity = GetProcAddress(handle, 'nvmlGpuInstanceGetComputeInstanceRemainingCapacity') + + global __nvmlGpuInstanceGetComputeInstancePossiblePlacements + __nvmlGpuInstanceGetComputeInstancePossiblePlacements = GetProcAddress(handle, 'nvmlGpuInstanceGetComputeInstancePossiblePlacements') + + global __nvmlGpuInstanceCreateComputeInstance + __nvmlGpuInstanceCreateComputeInstance = GetProcAddress(handle, 'nvmlGpuInstanceCreateComputeInstance') + + global __nvmlGpuInstanceCreateComputeInstanceWithPlacement + __nvmlGpuInstanceCreateComputeInstanceWithPlacement = GetProcAddress(handle, 'nvmlGpuInstanceCreateComputeInstanceWithPlacement') + + global __nvmlComputeInstanceDestroy + __nvmlComputeInstanceDestroy = GetProcAddress(handle, 'nvmlComputeInstanceDestroy') + + global __nvmlGpuInstanceGetComputeInstances + __nvmlGpuInstanceGetComputeInstances = GetProcAddress(handle, 'nvmlGpuInstanceGetComputeInstances') + + global __nvmlGpuInstanceGetComputeInstanceById + __nvmlGpuInstanceGetComputeInstanceById = GetProcAddress(handle, 'nvmlGpuInstanceGetComputeInstanceById') + + global __nvmlComputeInstanceGetInfo_v2 + __nvmlComputeInstanceGetInfo_v2 = GetProcAddress(handle, 'nvmlComputeInstanceGetInfo_v2') + + global __nvmlDeviceIsMigDeviceHandle + __nvmlDeviceIsMigDeviceHandle = GetProcAddress(handle, 'nvmlDeviceIsMigDeviceHandle') + + global __nvmlDeviceGetGpuInstanceId + __nvmlDeviceGetGpuInstanceId = GetProcAddress(handle, 'nvmlDeviceGetGpuInstanceId') + + global __nvmlDeviceGetComputeInstanceId + __nvmlDeviceGetComputeInstanceId = GetProcAddress(handle, 'nvmlDeviceGetComputeInstanceId') + + global __nvmlDeviceGetMaxMigDeviceCount + __nvmlDeviceGetMaxMigDeviceCount = GetProcAddress(handle, 'nvmlDeviceGetMaxMigDeviceCount') + + global __nvmlDeviceGetMigDeviceHandleByIndex + __nvmlDeviceGetMigDeviceHandleByIndex = GetProcAddress(handle, 'nvmlDeviceGetMigDeviceHandleByIndex') + + global __nvmlDeviceGetDeviceHandleFromMigDeviceHandle + __nvmlDeviceGetDeviceHandleFromMigDeviceHandle = GetProcAddress(handle, 'nvmlDeviceGetDeviceHandleFromMigDeviceHandle') + + global __nvmlGpmSampleGet + __nvmlGpmSampleGet = GetProcAddress(handle, 'nvmlGpmSampleGet') + + global __nvmlGpmMigSampleGet + __nvmlGpmMigSampleGet = GetProcAddress(handle, 'nvmlGpmMigSampleGet') + + global __nvmlGpmQueryDeviceSupport + __nvmlGpmQueryDeviceSupport = GetProcAddress(handle, 'nvmlGpmQueryDeviceSupport') + + global __nvmlGpmQueryIfStreamingEnabled + __nvmlGpmQueryIfStreamingEnabled = GetProcAddress(handle, 'nvmlGpmQueryIfStreamingEnabled') + + global __nvmlGpmSetStreamingEnabled + __nvmlGpmSetStreamingEnabled = GetProcAddress(handle, 'nvmlGpmSetStreamingEnabled') + + global __nvmlDeviceGetCapabilities + __nvmlDeviceGetCapabilities = GetProcAddress(handle, 'nvmlDeviceGetCapabilities') + + global __nvmlDeviceWorkloadPowerProfileClearRequestedProfiles + __nvmlDeviceWorkloadPowerProfileClearRequestedProfiles = GetProcAddress(handle, 'nvmlDeviceWorkloadPowerProfileClearRequestedProfiles') + + global __nvmlDevicePowerSmoothingActivatePresetProfile + __nvmlDevicePowerSmoothingActivatePresetProfile = GetProcAddress(handle, 'nvmlDevicePowerSmoothingActivatePresetProfile') + + global __nvmlDevicePowerSmoothingUpdatePresetProfileParam + __nvmlDevicePowerSmoothingUpdatePresetProfileParam = GetProcAddress(handle, 'nvmlDevicePowerSmoothingUpdatePresetProfileParam') + + global __nvmlDevicePowerSmoothingSetState + __nvmlDevicePowerSmoothingSetState = GetProcAddress(handle, 'nvmlDevicePowerSmoothingSetState') + + global __nvmlDeviceGetAddressingMode + __nvmlDeviceGetAddressingMode = GetProcAddress(handle, 'nvmlDeviceGetAddressingMode') + + global __nvmlDeviceGetRepairStatus + __nvmlDeviceGetRepairStatus = GetProcAddress(handle, 'nvmlDeviceGetRepairStatus') + + global __nvmlDeviceGetPowerMizerMode_v1 + __nvmlDeviceGetPowerMizerMode_v1 = GetProcAddress(handle, 'nvmlDeviceGetPowerMizerMode_v1') + + global __nvmlDeviceSetPowerMizerMode_v1 + __nvmlDeviceSetPowerMizerMode_v1 = GetProcAddress(handle, 'nvmlDeviceSetPowerMizerMode_v1') + + global __nvmlDeviceGetPdi + __nvmlDeviceGetPdi = GetProcAddress(handle, 'nvmlDeviceGetPdi') + + global __nvmlDeviceSetHostname_v1 + __nvmlDeviceSetHostname_v1 = GetProcAddress(handle, 'nvmlDeviceSetHostname_v1') + + global __nvmlDeviceGetHostname_v1 + __nvmlDeviceGetHostname_v1 = GetProcAddress(handle, 'nvmlDeviceGetHostname_v1') + + global __nvmlDeviceGetNvLinkInfo + __nvmlDeviceGetNvLinkInfo = GetProcAddress(handle, 'nvmlDeviceGetNvLinkInfo') + + global __nvmlDeviceReadWritePRM_v1 + __nvmlDeviceReadWritePRM_v1 = GetProcAddress(handle, 'nvmlDeviceReadWritePRM_v1') + + global __nvmlDeviceGetGpuInstanceProfileInfoByIdV + __nvmlDeviceGetGpuInstanceProfileInfoByIdV = GetProcAddress(handle, 'nvmlDeviceGetGpuInstanceProfileInfoByIdV') + + global __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts + __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts = GetProcAddress(handle, 'nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts') + + __py_nvml_init = True + return 0 + + +cdef dict func_ptrs = None + + +cpdef dict _inspect_function_pointers(): + global func_ptrs + if func_ptrs is not None: + return func_ptrs + + _check_or_init_nvml() + cdef dict data = {} + + global __nvmlInit_v2 + data["__nvmlInit_v2"] = __nvmlInit_v2 + + global __nvmlInitWithFlags + data["__nvmlInitWithFlags"] = __nvmlInitWithFlags + + global __nvmlShutdown + data["__nvmlShutdown"] = __nvmlShutdown + + global __nvmlErrorString + data["__nvmlErrorString"] = __nvmlErrorString + + global __nvmlSystemGetDriverVersion + data["__nvmlSystemGetDriverVersion"] = __nvmlSystemGetDriverVersion + + global __nvmlSystemGetNVMLVersion + data["__nvmlSystemGetNVMLVersion"] = __nvmlSystemGetNVMLVersion + + global __nvmlSystemGetCudaDriverVersion + data["__nvmlSystemGetCudaDriverVersion"] = __nvmlSystemGetCudaDriverVersion + + global __nvmlSystemGetCudaDriverVersion_v2 + data["__nvmlSystemGetCudaDriverVersion_v2"] = __nvmlSystemGetCudaDriverVersion_v2 + + global __nvmlSystemGetProcessName + data["__nvmlSystemGetProcessName"] = __nvmlSystemGetProcessName + + global __nvmlSystemGetHicVersion + data["__nvmlSystemGetHicVersion"] = __nvmlSystemGetHicVersion + + global __nvmlSystemGetTopologyGpuSet + data["__nvmlSystemGetTopologyGpuSet"] = __nvmlSystemGetTopologyGpuSet + + global __nvmlSystemGetDriverBranch + data["__nvmlSystemGetDriverBranch"] = __nvmlSystemGetDriverBranch + + global __nvmlUnitGetCount + data["__nvmlUnitGetCount"] = __nvmlUnitGetCount + + global __nvmlUnitGetHandleByIndex + data["__nvmlUnitGetHandleByIndex"] = __nvmlUnitGetHandleByIndex + + global __nvmlUnitGetUnitInfo + data["__nvmlUnitGetUnitInfo"] = __nvmlUnitGetUnitInfo + + global __nvmlUnitGetLedState + data["__nvmlUnitGetLedState"] = __nvmlUnitGetLedState + + global __nvmlUnitGetPsuInfo + data["__nvmlUnitGetPsuInfo"] = __nvmlUnitGetPsuInfo + + global __nvmlUnitGetTemperature + data["__nvmlUnitGetTemperature"] = __nvmlUnitGetTemperature + + global __nvmlUnitGetFanSpeedInfo + data["__nvmlUnitGetFanSpeedInfo"] = __nvmlUnitGetFanSpeedInfo + + global __nvmlUnitGetDevices + data["__nvmlUnitGetDevices"] = __nvmlUnitGetDevices + + global __nvmlDeviceGetCount_v2 + data["__nvmlDeviceGetCount_v2"] = __nvmlDeviceGetCount_v2 + + global __nvmlDeviceGetAttributes_v2 + data["__nvmlDeviceGetAttributes_v2"] = __nvmlDeviceGetAttributes_v2 + + global __nvmlDeviceGetHandleByIndex_v2 + data["__nvmlDeviceGetHandleByIndex_v2"] = __nvmlDeviceGetHandleByIndex_v2 + + global __nvmlDeviceGetHandleBySerial + data["__nvmlDeviceGetHandleBySerial"] = __nvmlDeviceGetHandleBySerial + + global __nvmlDeviceGetHandleByUUID + data["__nvmlDeviceGetHandleByUUID"] = __nvmlDeviceGetHandleByUUID + + global __nvmlDeviceGetHandleByUUIDV + data["__nvmlDeviceGetHandleByUUIDV"] = __nvmlDeviceGetHandleByUUIDV + + global __nvmlDeviceGetHandleByPciBusId_v2 + data["__nvmlDeviceGetHandleByPciBusId_v2"] = __nvmlDeviceGetHandleByPciBusId_v2 + + global __nvmlDeviceGetName + data["__nvmlDeviceGetName"] = __nvmlDeviceGetName + + global __nvmlDeviceGetBrand + data["__nvmlDeviceGetBrand"] = __nvmlDeviceGetBrand + + global __nvmlDeviceGetIndex + data["__nvmlDeviceGetIndex"] = __nvmlDeviceGetIndex + + global __nvmlDeviceGetSerial + data["__nvmlDeviceGetSerial"] = __nvmlDeviceGetSerial + + global __nvmlDeviceGetModuleId + data["__nvmlDeviceGetModuleId"] = __nvmlDeviceGetModuleId + + global __nvmlDeviceGetC2cModeInfoV + data["__nvmlDeviceGetC2cModeInfoV"] = __nvmlDeviceGetC2cModeInfoV + + global __nvmlDeviceGetMemoryAffinity + data["__nvmlDeviceGetMemoryAffinity"] = __nvmlDeviceGetMemoryAffinity + + global __nvmlDeviceGetCpuAffinityWithinScope + data["__nvmlDeviceGetCpuAffinityWithinScope"] = __nvmlDeviceGetCpuAffinityWithinScope + + global __nvmlDeviceGetCpuAffinity + data["__nvmlDeviceGetCpuAffinity"] = __nvmlDeviceGetCpuAffinity + + global __nvmlDeviceSetCpuAffinity + data["__nvmlDeviceSetCpuAffinity"] = __nvmlDeviceSetCpuAffinity + + global __nvmlDeviceClearCpuAffinity + data["__nvmlDeviceClearCpuAffinity"] = __nvmlDeviceClearCpuAffinity + + global __nvmlDeviceGetNumaNodeId + data["__nvmlDeviceGetNumaNodeId"] = __nvmlDeviceGetNumaNodeId + + global __nvmlDeviceGetTopologyCommonAncestor + data["__nvmlDeviceGetTopologyCommonAncestor"] = __nvmlDeviceGetTopologyCommonAncestor + + global __nvmlDeviceGetTopologyNearestGpus + data["__nvmlDeviceGetTopologyNearestGpus"] = __nvmlDeviceGetTopologyNearestGpus + + global __nvmlDeviceGetP2PStatus + data["__nvmlDeviceGetP2PStatus"] = __nvmlDeviceGetP2PStatus + + global __nvmlDeviceGetUUID + data["__nvmlDeviceGetUUID"] = __nvmlDeviceGetUUID + + global __nvmlDeviceGetMinorNumber + data["__nvmlDeviceGetMinorNumber"] = __nvmlDeviceGetMinorNumber + + global __nvmlDeviceGetBoardPartNumber + data["__nvmlDeviceGetBoardPartNumber"] = __nvmlDeviceGetBoardPartNumber + + global __nvmlDeviceGetInforomVersion + data["__nvmlDeviceGetInforomVersion"] = __nvmlDeviceGetInforomVersion + + global __nvmlDeviceGetInforomImageVersion + data["__nvmlDeviceGetInforomImageVersion"] = __nvmlDeviceGetInforomImageVersion + + global __nvmlDeviceGetInforomConfigurationChecksum + data["__nvmlDeviceGetInforomConfigurationChecksum"] = __nvmlDeviceGetInforomConfigurationChecksum + + global __nvmlDeviceValidateInforom + data["__nvmlDeviceValidateInforom"] = __nvmlDeviceValidateInforom + + global __nvmlDeviceGetLastBBXFlushTime + data["__nvmlDeviceGetLastBBXFlushTime"] = __nvmlDeviceGetLastBBXFlushTime + + global __nvmlDeviceGetDisplayMode + data["__nvmlDeviceGetDisplayMode"] = __nvmlDeviceGetDisplayMode + + global __nvmlDeviceGetDisplayActive + data["__nvmlDeviceGetDisplayActive"] = __nvmlDeviceGetDisplayActive + + global __nvmlDeviceGetPersistenceMode + data["__nvmlDeviceGetPersistenceMode"] = __nvmlDeviceGetPersistenceMode + + global __nvmlDeviceGetPciInfoExt + data["__nvmlDeviceGetPciInfoExt"] = __nvmlDeviceGetPciInfoExt + + global __nvmlDeviceGetPciInfo_v3 + data["__nvmlDeviceGetPciInfo_v3"] = __nvmlDeviceGetPciInfo_v3 + + global __nvmlDeviceGetMaxPcieLinkGeneration + data["__nvmlDeviceGetMaxPcieLinkGeneration"] = __nvmlDeviceGetMaxPcieLinkGeneration + + global __nvmlDeviceGetGpuMaxPcieLinkGeneration + data["__nvmlDeviceGetGpuMaxPcieLinkGeneration"] = __nvmlDeviceGetGpuMaxPcieLinkGeneration + + global __nvmlDeviceGetMaxPcieLinkWidth + data["__nvmlDeviceGetMaxPcieLinkWidth"] = __nvmlDeviceGetMaxPcieLinkWidth + + global __nvmlDeviceGetCurrPcieLinkGeneration + data["__nvmlDeviceGetCurrPcieLinkGeneration"] = __nvmlDeviceGetCurrPcieLinkGeneration + + global __nvmlDeviceGetCurrPcieLinkWidth + data["__nvmlDeviceGetCurrPcieLinkWidth"] = __nvmlDeviceGetCurrPcieLinkWidth + + global __nvmlDeviceGetPcieThroughput + data["__nvmlDeviceGetPcieThroughput"] = __nvmlDeviceGetPcieThroughput + + global __nvmlDeviceGetPcieReplayCounter + data["__nvmlDeviceGetPcieReplayCounter"] = __nvmlDeviceGetPcieReplayCounter + + global __nvmlDeviceGetClockInfo + data["__nvmlDeviceGetClockInfo"] = __nvmlDeviceGetClockInfo + + global __nvmlDeviceGetMaxClockInfo + data["__nvmlDeviceGetMaxClockInfo"] = __nvmlDeviceGetMaxClockInfo + + global __nvmlDeviceGetGpcClkVfOffset + data["__nvmlDeviceGetGpcClkVfOffset"] = __nvmlDeviceGetGpcClkVfOffset + + global __nvmlDeviceGetClock + data["__nvmlDeviceGetClock"] = __nvmlDeviceGetClock + + global __nvmlDeviceGetMaxCustomerBoostClock + data["__nvmlDeviceGetMaxCustomerBoostClock"] = __nvmlDeviceGetMaxCustomerBoostClock + + global __nvmlDeviceGetSupportedMemoryClocks + data["__nvmlDeviceGetSupportedMemoryClocks"] = __nvmlDeviceGetSupportedMemoryClocks + + global __nvmlDeviceGetSupportedGraphicsClocks + data["__nvmlDeviceGetSupportedGraphicsClocks"] = __nvmlDeviceGetSupportedGraphicsClocks + + global __nvmlDeviceGetAutoBoostedClocksEnabled + data["__nvmlDeviceGetAutoBoostedClocksEnabled"] = __nvmlDeviceGetAutoBoostedClocksEnabled + + global __nvmlDeviceGetFanSpeed + data["__nvmlDeviceGetFanSpeed"] = __nvmlDeviceGetFanSpeed + + global __nvmlDeviceGetFanSpeed_v2 + data["__nvmlDeviceGetFanSpeed_v2"] = __nvmlDeviceGetFanSpeed_v2 + + global __nvmlDeviceGetFanSpeedRPM + data["__nvmlDeviceGetFanSpeedRPM"] = __nvmlDeviceGetFanSpeedRPM + + global __nvmlDeviceGetTargetFanSpeed + data["__nvmlDeviceGetTargetFanSpeed"] = __nvmlDeviceGetTargetFanSpeed + + global __nvmlDeviceGetMinMaxFanSpeed + data["__nvmlDeviceGetMinMaxFanSpeed"] = __nvmlDeviceGetMinMaxFanSpeed + + global __nvmlDeviceGetFanControlPolicy_v2 + data["__nvmlDeviceGetFanControlPolicy_v2"] = __nvmlDeviceGetFanControlPolicy_v2 + + global __nvmlDeviceGetNumFans + data["__nvmlDeviceGetNumFans"] = __nvmlDeviceGetNumFans + + global __nvmlDeviceGetCoolerInfo + data["__nvmlDeviceGetCoolerInfo"] = __nvmlDeviceGetCoolerInfo + + global __nvmlDeviceGetTemperatureV + data["__nvmlDeviceGetTemperatureV"] = __nvmlDeviceGetTemperatureV + + global __nvmlDeviceGetTemperatureThreshold + data["__nvmlDeviceGetTemperatureThreshold"] = __nvmlDeviceGetTemperatureThreshold + + global __nvmlDeviceGetMarginTemperature + data["__nvmlDeviceGetMarginTemperature"] = __nvmlDeviceGetMarginTemperature + + global __nvmlDeviceGetThermalSettings + data["__nvmlDeviceGetThermalSettings"] = __nvmlDeviceGetThermalSettings + + global __nvmlDeviceGetPerformanceState + data["__nvmlDeviceGetPerformanceState"] = __nvmlDeviceGetPerformanceState + + global __nvmlDeviceGetCurrentClocksEventReasons + data["__nvmlDeviceGetCurrentClocksEventReasons"] = __nvmlDeviceGetCurrentClocksEventReasons + + global __nvmlDeviceGetSupportedClocksEventReasons + data["__nvmlDeviceGetSupportedClocksEventReasons"] = __nvmlDeviceGetSupportedClocksEventReasons + + global __nvmlDeviceGetPowerState + data["__nvmlDeviceGetPowerState"] = __nvmlDeviceGetPowerState + + global __nvmlDeviceGetDynamicPstatesInfo + data["__nvmlDeviceGetDynamicPstatesInfo"] = __nvmlDeviceGetDynamicPstatesInfo + + global __nvmlDeviceGetMemClkVfOffset + data["__nvmlDeviceGetMemClkVfOffset"] = __nvmlDeviceGetMemClkVfOffset + + global __nvmlDeviceGetMinMaxClockOfPState + data["__nvmlDeviceGetMinMaxClockOfPState"] = __nvmlDeviceGetMinMaxClockOfPState + + global __nvmlDeviceGetSupportedPerformanceStates + data["__nvmlDeviceGetSupportedPerformanceStates"] = __nvmlDeviceGetSupportedPerformanceStates + + global __nvmlDeviceGetGpcClkMinMaxVfOffset + data["__nvmlDeviceGetGpcClkMinMaxVfOffset"] = __nvmlDeviceGetGpcClkMinMaxVfOffset + + global __nvmlDeviceGetMemClkMinMaxVfOffset + data["__nvmlDeviceGetMemClkMinMaxVfOffset"] = __nvmlDeviceGetMemClkMinMaxVfOffset + + global __nvmlDeviceGetClockOffsets + data["__nvmlDeviceGetClockOffsets"] = __nvmlDeviceGetClockOffsets + + global __nvmlDeviceSetClockOffsets + data["__nvmlDeviceSetClockOffsets"] = __nvmlDeviceSetClockOffsets + + global __nvmlDeviceGetPerformanceModes + data["__nvmlDeviceGetPerformanceModes"] = __nvmlDeviceGetPerformanceModes + + global __nvmlDeviceGetCurrentClockFreqs + data["__nvmlDeviceGetCurrentClockFreqs"] = __nvmlDeviceGetCurrentClockFreqs + + global __nvmlDeviceGetPowerManagementLimit + data["__nvmlDeviceGetPowerManagementLimit"] = __nvmlDeviceGetPowerManagementLimit + + global __nvmlDeviceGetPowerManagementLimitConstraints + data["__nvmlDeviceGetPowerManagementLimitConstraints"] = __nvmlDeviceGetPowerManagementLimitConstraints + + global __nvmlDeviceGetPowerManagementDefaultLimit + data["__nvmlDeviceGetPowerManagementDefaultLimit"] = __nvmlDeviceGetPowerManagementDefaultLimit + + global __nvmlDeviceGetPowerUsage + data["__nvmlDeviceGetPowerUsage"] = __nvmlDeviceGetPowerUsage + + global __nvmlDeviceGetTotalEnergyConsumption + data["__nvmlDeviceGetTotalEnergyConsumption"] = __nvmlDeviceGetTotalEnergyConsumption + + global __nvmlDeviceGetEnforcedPowerLimit + data["__nvmlDeviceGetEnforcedPowerLimit"] = __nvmlDeviceGetEnforcedPowerLimit + + global __nvmlDeviceGetGpuOperationMode + data["__nvmlDeviceGetGpuOperationMode"] = __nvmlDeviceGetGpuOperationMode + + global __nvmlDeviceGetMemoryInfo_v2 + data["__nvmlDeviceGetMemoryInfo_v2"] = __nvmlDeviceGetMemoryInfo_v2 + + global __nvmlDeviceGetComputeMode + data["__nvmlDeviceGetComputeMode"] = __nvmlDeviceGetComputeMode + + global __nvmlDeviceGetCudaComputeCapability + data["__nvmlDeviceGetCudaComputeCapability"] = __nvmlDeviceGetCudaComputeCapability + + global __nvmlDeviceGetDramEncryptionMode + data["__nvmlDeviceGetDramEncryptionMode"] = __nvmlDeviceGetDramEncryptionMode + + global __nvmlDeviceSetDramEncryptionMode + data["__nvmlDeviceSetDramEncryptionMode"] = __nvmlDeviceSetDramEncryptionMode + + global __nvmlDeviceGetEccMode + data["__nvmlDeviceGetEccMode"] = __nvmlDeviceGetEccMode + + global __nvmlDeviceGetDefaultEccMode + data["__nvmlDeviceGetDefaultEccMode"] = __nvmlDeviceGetDefaultEccMode + + global __nvmlDeviceGetBoardId + data["__nvmlDeviceGetBoardId"] = __nvmlDeviceGetBoardId + + global __nvmlDeviceGetMultiGpuBoard + data["__nvmlDeviceGetMultiGpuBoard"] = __nvmlDeviceGetMultiGpuBoard + + global __nvmlDeviceGetTotalEccErrors + data["__nvmlDeviceGetTotalEccErrors"] = __nvmlDeviceGetTotalEccErrors + + global __nvmlDeviceGetMemoryErrorCounter + data["__nvmlDeviceGetMemoryErrorCounter"] = __nvmlDeviceGetMemoryErrorCounter + + global __nvmlDeviceGetUtilizationRates + data["__nvmlDeviceGetUtilizationRates"] = __nvmlDeviceGetUtilizationRates + + global __nvmlDeviceGetEncoderUtilization + data["__nvmlDeviceGetEncoderUtilization"] = __nvmlDeviceGetEncoderUtilization + + global __nvmlDeviceGetEncoderCapacity + data["__nvmlDeviceGetEncoderCapacity"] = __nvmlDeviceGetEncoderCapacity + + global __nvmlDeviceGetEncoderStats + data["__nvmlDeviceGetEncoderStats"] = __nvmlDeviceGetEncoderStats + + global __nvmlDeviceGetEncoderSessions + data["__nvmlDeviceGetEncoderSessions"] = __nvmlDeviceGetEncoderSessions + + global __nvmlDeviceGetDecoderUtilization + data["__nvmlDeviceGetDecoderUtilization"] = __nvmlDeviceGetDecoderUtilization + + global __nvmlDeviceGetJpgUtilization + data["__nvmlDeviceGetJpgUtilization"] = __nvmlDeviceGetJpgUtilization + + global __nvmlDeviceGetOfaUtilization + data["__nvmlDeviceGetOfaUtilization"] = __nvmlDeviceGetOfaUtilization + + global __nvmlDeviceGetFBCStats + data["__nvmlDeviceGetFBCStats"] = __nvmlDeviceGetFBCStats + + global __nvmlDeviceGetFBCSessions + data["__nvmlDeviceGetFBCSessions"] = __nvmlDeviceGetFBCSessions + + global __nvmlDeviceGetDriverModel_v2 + data["__nvmlDeviceGetDriverModel_v2"] = __nvmlDeviceGetDriverModel_v2 + + global __nvmlDeviceGetVbiosVersion + data["__nvmlDeviceGetVbiosVersion"] = __nvmlDeviceGetVbiosVersion + + global __nvmlDeviceGetBridgeChipInfo + data["__nvmlDeviceGetBridgeChipInfo"] = __nvmlDeviceGetBridgeChipInfo + + global __nvmlDeviceGetComputeRunningProcesses_v3 + data["__nvmlDeviceGetComputeRunningProcesses_v3"] = __nvmlDeviceGetComputeRunningProcesses_v3 + + global __nvmlDeviceGetGraphicsRunningProcesses_v3 + data["__nvmlDeviceGetGraphicsRunningProcesses_v3"] = __nvmlDeviceGetGraphicsRunningProcesses_v3 + + global __nvmlDeviceGetMPSComputeRunningProcesses_v3 + data["__nvmlDeviceGetMPSComputeRunningProcesses_v3"] = __nvmlDeviceGetMPSComputeRunningProcesses_v3 + + global __nvmlDeviceGetRunningProcessDetailList + data["__nvmlDeviceGetRunningProcessDetailList"] = __nvmlDeviceGetRunningProcessDetailList + + global __nvmlDeviceOnSameBoard + data["__nvmlDeviceOnSameBoard"] = __nvmlDeviceOnSameBoard + + global __nvmlDeviceGetAPIRestriction + data["__nvmlDeviceGetAPIRestriction"] = __nvmlDeviceGetAPIRestriction + + global __nvmlDeviceGetSamples + data["__nvmlDeviceGetSamples"] = __nvmlDeviceGetSamples + + global __nvmlDeviceGetBAR1MemoryInfo + data["__nvmlDeviceGetBAR1MemoryInfo"] = __nvmlDeviceGetBAR1MemoryInfo + + global __nvmlDeviceGetIrqNum + data["__nvmlDeviceGetIrqNum"] = __nvmlDeviceGetIrqNum + + global __nvmlDeviceGetNumGpuCores + data["__nvmlDeviceGetNumGpuCores"] = __nvmlDeviceGetNumGpuCores + + global __nvmlDeviceGetPowerSource + data["__nvmlDeviceGetPowerSource"] = __nvmlDeviceGetPowerSource + + global __nvmlDeviceGetMemoryBusWidth + data["__nvmlDeviceGetMemoryBusWidth"] = __nvmlDeviceGetMemoryBusWidth + + global __nvmlDeviceGetPcieLinkMaxSpeed + data["__nvmlDeviceGetPcieLinkMaxSpeed"] = __nvmlDeviceGetPcieLinkMaxSpeed + + global __nvmlDeviceGetPcieSpeed + data["__nvmlDeviceGetPcieSpeed"] = __nvmlDeviceGetPcieSpeed + + global __nvmlDeviceGetAdaptiveClockInfoStatus + data["__nvmlDeviceGetAdaptiveClockInfoStatus"] = __nvmlDeviceGetAdaptiveClockInfoStatus + + global __nvmlDeviceGetBusType + data["__nvmlDeviceGetBusType"] = __nvmlDeviceGetBusType + + global __nvmlDeviceGetGpuFabricInfoV + data["__nvmlDeviceGetGpuFabricInfoV"] = __nvmlDeviceGetGpuFabricInfoV + + global __nvmlSystemGetConfComputeCapabilities + data["__nvmlSystemGetConfComputeCapabilities"] = __nvmlSystemGetConfComputeCapabilities + + global __nvmlSystemGetConfComputeState + data["__nvmlSystemGetConfComputeState"] = __nvmlSystemGetConfComputeState + + global __nvmlDeviceGetConfComputeMemSizeInfo + data["__nvmlDeviceGetConfComputeMemSizeInfo"] = __nvmlDeviceGetConfComputeMemSizeInfo + + global __nvmlSystemGetConfComputeGpusReadyState + data["__nvmlSystemGetConfComputeGpusReadyState"] = __nvmlSystemGetConfComputeGpusReadyState + + global __nvmlDeviceGetConfComputeProtectedMemoryUsage + data["__nvmlDeviceGetConfComputeProtectedMemoryUsage"] = __nvmlDeviceGetConfComputeProtectedMemoryUsage + + global __nvmlDeviceGetConfComputeGpuCertificate + data["__nvmlDeviceGetConfComputeGpuCertificate"] = __nvmlDeviceGetConfComputeGpuCertificate + + global __nvmlDeviceGetConfComputeGpuAttestationReport + data["__nvmlDeviceGetConfComputeGpuAttestationReport"] = __nvmlDeviceGetConfComputeGpuAttestationReport + + global __nvmlSystemGetConfComputeKeyRotationThresholdInfo + data["__nvmlSystemGetConfComputeKeyRotationThresholdInfo"] = __nvmlSystemGetConfComputeKeyRotationThresholdInfo + + global __nvmlDeviceSetConfComputeUnprotectedMemSize + data["__nvmlDeviceSetConfComputeUnprotectedMemSize"] = __nvmlDeviceSetConfComputeUnprotectedMemSize + + global __nvmlSystemSetConfComputeGpusReadyState + data["__nvmlSystemSetConfComputeGpusReadyState"] = __nvmlSystemSetConfComputeGpusReadyState + + global __nvmlSystemSetConfComputeKeyRotationThresholdInfo + data["__nvmlSystemSetConfComputeKeyRotationThresholdInfo"] = __nvmlSystemSetConfComputeKeyRotationThresholdInfo + + global __nvmlSystemGetConfComputeSettings + data["__nvmlSystemGetConfComputeSettings"] = __nvmlSystemGetConfComputeSettings + + global __nvmlDeviceGetGspFirmwareVersion + data["__nvmlDeviceGetGspFirmwareVersion"] = __nvmlDeviceGetGspFirmwareVersion + + global __nvmlDeviceGetGspFirmwareMode + data["__nvmlDeviceGetGspFirmwareMode"] = __nvmlDeviceGetGspFirmwareMode + + global __nvmlDeviceGetSramEccErrorStatus + data["__nvmlDeviceGetSramEccErrorStatus"] = __nvmlDeviceGetSramEccErrorStatus + + global __nvmlDeviceGetAccountingMode + data["__nvmlDeviceGetAccountingMode"] = __nvmlDeviceGetAccountingMode + + global __nvmlDeviceGetAccountingStats + data["__nvmlDeviceGetAccountingStats"] = __nvmlDeviceGetAccountingStats + + global __nvmlDeviceGetAccountingPids + data["__nvmlDeviceGetAccountingPids"] = __nvmlDeviceGetAccountingPids + + global __nvmlDeviceGetAccountingBufferSize + data["__nvmlDeviceGetAccountingBufferSize"] = __nvmlDeviceGetAccountingBufferSize + + global __nvmlDeviceGetRetiredPages + data["__nvmlDeviceGetRetiredPages"] = __nvmlDeviceGetRetiredPages + + global __nvmlDeviceGetRetiredPages_v2 + data["__nvmlDeviceGetRetiredPages_v2"] = __nvmlDeviceGetRetiredPages_v2 + + global __nvmlDeviceGetRetiredPagesPendingStatus + data["__nvmlDeviceGetRetiredPagesPendingStatus"] = __nvmlDeviceGetRetiredPagesPendingStatus + + global __nvmlDeviceGetRemappedRows + data["__nvmlDeviceGetRemappedRows"] = __nvmlDeviceGetRemappedRows + + global __nvmlDeviceGetRowRemapperHistogram + data["__nvmlDeviceGetRowRemapperHistogram"] = __nvmlDeviceGetRowRemapperHistogram + + global __nvmlDeviceGetArchitecture + data["__nvmlDeviceGetArchitecture"] = __nvmlDeviceGetArchitecture + + global __nvmlDeviceGetClkMonStatus + data["__nvmlDeviceGetClkMonStatus"] = __nvmlDeviceGetClkMonStatus + + global __nvmlDeviceGetProcessUtilization + data["__nvmlDeviceGetProcessUtilization"] = __nvmlDeviceGetProcessUtilization + + global __nvmlDeviceGetProcessesUtilizationInfo + data["__nvmlDeviceGetProcessesUtilizationInfo"] = __nvmlDeviceGetProcessesUtilizationInfo + + global __nvmlDeviceGetPlatformInfo + data["__nvmlDeviceGetPlatformInfo"] = __nvmlDeviceGetPlatformInfo + + global __nvmlUnitSetLedState + data["__nvmlUnitSetLedState"] = __nvmlUnitSetLedState + + global __nvmlDeviceSetPersistenceMode + data["__nvmlDeviceSetPersistenceMode"] = __nvmlDeviceSetPersistenceMode + + global __nvmlDeviceSetComputeMode + data["__nvmlDeviceSetComputeMode"] = __nvmlDeviceSetComputeMode + + global __nvmlDeviceSetEccMode + data["__nvmlDeviceSetEccMode"] = __nvmlDeviceSetEccMode + + global __nvmlDeviceClearEccErrorCounts + data["__nvmlDeviceClearEccErrorCounts"] = __nvmlDeviceClearEccErrorCounts + + global __nvmlDeviceSetDriverModel + data["__nvmlDeviceSetDriverModel"] = __nvmlDeviceSetDriverModel + + global __nvmlDeviceSetGpuLockedClocks + data["__nvmlDeviceSetGpuLockedClocks"] = __nvmlDeviceSetGpuLockedClocks + + global __nvmlDeviceResetGpuLockedClocks + data["__nvmlDeviceResetGpuLockedClocks"] = __nvmlDeviceResetGpuLockedClocks + + global __nvmlDeviceSetMemoryLockedClocks + data["__nvmlDeviceSetMemoryLockedClocks"] = __nvmlDeviceSetMemoryLockedClocks + + global __nvmlDeviceResetMemoryLockedClocks + data["__nvmlDeviceResetMemoryLockedClocks"] = __nvmlDeviceResetMemoryLockedClocks + + global __nvmlDeviceSetAutoBoostedClocksEnabled + data["__nvmlDeviceSetAutoBoostedClocksEnabled"] = __nvmlDeviceSetAutoBoostedClocksEnabled + + global __nvmlDeviceSetDefaultAutoBoostedClocksEnabled + data["__nvmlDeviceSetDefaultAutoBoostedClocksEnabled"] = __nvmlDeviceSetDefaultAutoBoostedClocksEnabled + + global __nvmlDeviceSetDefaultFanSpeed_v2 + data["__nvmlDeviceSetDefaultFanSpeed_v2"] = __nvmlDeviceSetDefaultFanSpeed_v2 + + global __nvmlDeviceSetFanControlPolicy + data["__nvmlDeviceSetFanControlPolicy"] = __nvmlDeviceSetFanControlPolicy + + global __nvmlDeviceSetTemperatureThreshold + data["__nvmlDeviceSetTemperatureThreshold"] = __nvmlDeviceSetTemperatureThreshold + + global __nvmlDeviceSetPowerManagementLimit + data["__nvmlDeviceSetPowerManagementLimit"] = __nvmlDeviceSetPowerManagementLimit + + global __nvmlDeviceSetGpuOperationMode + data["__nvmlDeviceSetGpuOperationMode"] = __nvmlDeviceSetGpuOperationMode + + global __nvmlDeviceSetAPIRestriction + data["__nvmlDeviceSetAPIRestriction"] = __nvmlDeviceSetAPIRestriction + + global __nvmlDeviceSetFanSpeed_v2 + data["__nvmlDeviceSetFanSpeed_v2"] = __nvmlDeviceSetFanSpeed_v2 + + global __nvmlDeviceSetAccountingMode + data["__nvmlDeviceSetAccountingMode"] = __nvmlDeviceSetAccountingMode + + global __nvmlDeviceClearAccountingPids + data["__nvmlDeviceClearAccountingPids"] = __nvmlDeviceClearAccountingPids + + global __nvmlDeviceSetPowerManagementLimit_v2 + data["__nvmlDeviceSetPowerManagementLimit_v2"] = __nvmlDeviceSetPowerManagementLimit_v2 + + global __nvmlDeviceGetNvLinkState + data["__nvmlDeviceGetNvLinkState"] = __nvmlDeviceGetNvLinkState + + global __nvmlDeviceGetNvLinkVersion + data["__nvmlDeviceGetNvLinkVersion"] = __nvmlDeviceGetNvLinkVersion + + global __nvmlDeviceGetNvLinkCapability + data["__nvmlDeviceGetNvLinkCapability"] = __nvmlDeviceGetNvLinkCapability + + global __nvmlDeviceGetNvLinkRemotePciInfo_v2 + data["__nvmlDeviceGetNvLinkRemotePciInfo_v2"] = __nvmlDeviceGetNvLinkRemotePciInfo_v2 + + global __nvmlDeviceGetNvLinkErrorCounter + data["__nvmlDeviceGetNvLinkErrorCounter"] = __nvmlDeviceGetNvLinkErrorCounter + + global __nvmlDeviceResetNvLinkErrorCounters + data["__nvmlDeviceResetNvLinkErrorCounters"] = __nvmlDeviceResetNvLinkErrorCounters + + global __nvmlDeviceGetNvLinkRemoteDeviceType + data["__nvmlDeviceGetNvLinkRemoteDeviceType"] = __nvmlDeviceGetNvLinkRemoteDeviceType + + global __nvmlDeviceSetNvLinkDeviceLowPowerThreshold + data["__nvmlDeviceSetNvLinkDeviceLowPowerThreshold"] = __nvmlDeviceSetNvLinkDeviceLowPowerThreshold + + global __nvmlSystemSetNvlinkBwMode + data["__nvmlSystemSetNvlinkBwMode"] = __nvmlSystemSetNvlinkBwMode + + global __nvmlSystemGetNvlinkBwMode + data["__nvmlSystemGetNvlinkBwMode"] = __nvmlSystemGetNvlinkBwMode + + global __nvmlDeviceGetNvlinkSupportedBwModes + data["__nvmlDeviceGetNvlinkSupportedBwModes"] = __nvmlDeviceGetNvlinkSupportedBwModes + + global __nvmlDeviceGetNvlinkBwMode + data["__nvmlDeviceGetNvlinkBwMode"] = __nvmlDeviceGetNvlinkBwMode + + global __nvmlDeviceSetNvlinkBwMode + data["__nvmlDeviceSetNvlinkBwMode"] = __nvmlDeviceSetNvlinkBwMode + + global __nvmlEventSetCreate + data["__nvmlEventSetCreate"] = __nvmlEventSetCreate + + global __nvmlDeviceRegisterEvents + data["__nvmlDeviceRegisterEvents"] = __nvmlDeviceRegisterEvents + + global __nvmlDeviceGetSupportedEventTypes + data["__nvmlDeviceGetSupportedEventTypes"] = __nvmlDeviceGetSupportedEventTypes + + global __nvmlEventSetWait_v2 + data["__nvmlEventSetWait_v2"] = __nvmlEventSetWait_v2 + + global __nvmlEventSetFree + data["__nvmlEventSetFree"] = __nvmlEventSetFree + + global __nvmlSystemEventSetCreate + data["__nvmlSystemEventSetCreate"] = __nvmlSystemEventSetCreate + + global __nvmlSystemEventSetFree + data["__nvmlSystemEventSetFree"] = __nvmlSystemEventSetFree + + global __nvmlSystemRegisterEvents + data["__nvmlSystemRegisterEvents"] = __nvmlSystemRegisterEvents + + global __nvmlSystemEventSetWait + data["__nvmlSystemEventSetWait"] = __nvmlSystemEventSetWait + + global __nvmlDeviceModifyDrainState + data["__nvmlDeviceModifyDrainState"] = __nvmlDeviceModifyDrainState + + global __nvmlDeviceQueryDrainState + data["__nvmlDeviceQueryDrainState"] = __nvmlDeviceQueryDrainState + + global __nvmlDeviceRemoveGpu_v2 + data["__nvmlDeviceRemoveGpu_v2"] = __nvmlDeviceRemoveGpu_v2 + + global __nvmlDeviceDiscoverGpus + data["__nvmlDeviceDiscoverGpus"] = __nvmlDeviceDiscoverGpus + + global __nvmlDeviceGetFieldValues + data["__nvmlDeviceGetFieldValues"] = __nvmlDeviceGetFieldValues + + global __nvmlDeviceClearFieldValues + data["__nvmlDeviceClearFieldValues"] = __nvmlDeviceClearFieldValues + + global __nvmlDeviceGetVirtualizationMode + data["__nvmlDeviceGetVirtualizationMode"] = __nvmlDeviceGetVirtualizationMode + + global __nvmlDeviceGetHostVgpuMode + data["__nvmlDeviceGetHostVgpuMode"] = __nvmlDeviceGetHostVgpuMode + + global __nvmlDeviceSetVirtualizationMode + data["__nvmlDeviceSetVirtualizationMode"] = __nvmlDeviceSetVirtualizationMode + + global __nvmlDeviceGetVgpuHeterogeneousMode + data["__nvmlDeviceGetVgpuHeterogeneousMode"] = __nvmlDeviceGetVgpuHeterogeneousMode + + global __nvmlDeviceSetVgpuHeterogeneousMode + data["__nvmlDeviceSetVgpuHeterogeneousMode"] = __nvmlDeviceSetVgpuHeterogeneousMode + + global __nvmlVgpuInstanceGetPlacementId + data["__nvmlVgpuInstanceGetPlacementId"] = __nvmlVgpuInstanceGetPlacementId + + global __nvmlDeviceGetVgpuTypeSupportedPlacements + data["__nvmlDeviceGetVgpuTypeSupportedPlacements"] = __nvmlDeviceGetVgpuTypeSupportedPlacements + + global __nvmlDeviceGetVgpuTypeCreatablePlacements + data["__nvmlDeviceGetVgpuTypeCreatablePlacements"] = __nvmlDeviceGetVgpuTypeCreatablePlacements + + global __nvmlVgpuTypeGetGspHeapSize + data["__nvmlVgpuTypeGetGspHeapSize"] = __nvmlVgpuTypeGetGspHeapSize + + global __nvmlVgpuTypeGetFbReservation + data["__nvmlVgpuTypeGetFbReservation"] = __nvmlVgpuTypeGetFbReservation + + global __nvmlVgpuInstanceGetRuntimeStateSize + data["__nvmlVgpuInstanceGetRuntimeStateSize"] = __nvmlVgpuInstanceGetRuntimeStateSize + + global __nvmlDeviceSetVgpuCapabilities + data["__nvmlDeviceSetVgpuCapabilities"] = __nvmlDeviceSetVgpuCapabilities + + global __nvmlDeviceGetGridLicensableFeatures_v4 + data["__nvmlDeviceGetGridLicensableFeatures_v4"] = __nvmlDeviceGetGridLicensableFeatures_v4 + + global __nvmlGetVgpuDriverCapabilities + data["__nvmlGetVgpuDriverCapabilities"] = __nvmlGetVgpuDriverCapabilities + + global __nvmlDeviceGetVgpuCapabilities + data["__nvmlDeviceGetVgpuCapabilities"] = __nvmlDeviceGetVgpuCapabilities + + global __nvmlDeviceGetSupportedVgpus + data["__nvmlDeviceGetSupportedVgpus"] = __nvmlDeviceGetSupportedVgpus + + global __nvmlDeviceGetCreatableVgpus + data["__nvmlDeviceGetCreatableVgpus"] = __nvmlDeviceGetCreatableVgpus + + global __nvmlVgpuTypeGetClass + data["__nvmlVgpuTypeGetClass"] = __nvmlVgpuTypeGetClass + + global __nvmlVgpuTypeGetName + data["__nvmlVgpuTypeGetName"] = __nvmlVgpuTypeGetName + + global __nvmlVgpuTypeGetGpuInstanceProfileId + data["__nvmlVgpuTypeGetGpuInstanceProfileId"] = __nvmlVgpuTypeGetGpuInstanceProfileId + + global __nvmlVgpuTypeGetDeviceID + data["__nvmlVgpuTypeGetDeviceID"] = __nvmlVgpuTypeGetDeviceID + + global __nvmlVgpuTypeGetFramebufferSize + data["__nvmlVgpuTypeGetFramebufferSize"] = __nvmlVgpuTypeGetFramebufferSize + + global __nvmlVgpuTypeGetNumDisplayHeads + data["__nvmlVgpuTypeGetNumDisplayHeads"] = __nvmlVgpuTypeGetNumDisplayHeads + + global __nvmlVgpuTypeGetResolution + data["__nvmlVgpuTypeGetResolution"] = __nvmlVgpuTypeGetResolution + + global __nvmlVgpuTypeGetLicense + data["__nvmlVgpuTypeGetLicense"] = __nvmlVgpuTypeGetLicense + + global __nvmlVgpuTypeGetFrameRateLimit + data["__nvmlVgpuTypeGetFrameRateLimit"] = __nvmlVgpuTypeGetFrameRateLimit + + global __nvmlVgpuTypeGetMaxInstances + data["__nvmlVgpuTypeGetMaxInstances"] = __nvmlVgpuTypeGetMaxInstances + + global __nvmlVgpuTypeGetMaxInstancesPerVm + data["__nvmlVgpuTypeGetMaxInstancesPerVm"] = __nvmlVgpuTypeGetMaxInstancesPerVm + + global __nvmlVgpuTypeGetBAR1Info + data["__nvmlVgpuTypeGetBAR1Info"] = __nvmlVgpuTypeGetBAR1Info + + global __nvmlDeviceGetActiveVgpus + data["__nvmlDeviceGetActiveVgpus"] = __nvmlDeviceGetActiveVgpus + + global __nvmlVgpuInstanceGetVmID + data["__nvmlVgpuInstanceGetVmID"] = __nvmlVgpuInstanceGetVmID + + global __nvmlVgpuInstanceGetUUID + data["__nvmlVgpuInstanceGetUUID"] = __nvmlVgpuInstanceGetUUID + + global __nvmlVgpuInstanceGetVmDriverVersion + data["__nvmlVgpuInstanceGetVmDriverVersion"] = __nvmlVgpuInstanceGetVmDriverVersion + + global __nvmlVgpuInstanceGetFbUsage + data["__nvmlVgpuInstanceGetFbUsage"] = __nvmlVgpuInstanceGetFbUsage + + global __nvmlVgpuInstanceGetLicenseStatus + data["__nvmlVgpuInstanceGetLicenseStatus"] = __nvmlVgpuInstanceGetLicenseStatus + + global __nvmlVgpuInstanceGetType + data["__nvmlVgpuInstanceGetType"] = __nvmlVgpuInstanceGetType + + global __nvmlVgpuInstanceGetFrameRateLimit + data["__nvmlVgpuInstanceGetFrameRateLimit"] = __nvmlVgpuInstanceGetFrameRateLimit + + global __nvmlVgpuInstanceGetEccMode + data["__nvmlVgpuInstanceGetEccMode"] = __nvmlVgpuInstanceGetEccMode + + global __nvmlVgpuInstanceGetEncoderCapacity + data["__nvmlVgpuInstanceGetEncoderCapacity"] = __nvmlVgpuInstanceGetEncoderCapacity + + global __nvmlVgpuInstanceSetEncoderCapacity + data["__nvmlVgpuInstanceSetEncoderCapacity"] = __nvmlVgpuInstanceSetEncoderCapacity + + global __nvmlVgpuInstanceGetEncoderStats + data["__nvmlVgpuInstanceGetEncoderStats"] = __nvmlVgpuInstanceGetEncoderStats + + global __nvmlVgpuInstanceGetEncoderSessions + data["__nvmlVgpuInstanceGetEncoderSessions"] = __nvmlVgpuInstanceGetEncoderSessions + + global __nvmlVgpuInstanceGetFBCStats + data["__nvmlVgpuInstanceGetFBCStats"] = __nvmlVgpuInstanceGetFBCStats + + global __nvmlVgpuInstanceGetFBCSessions + data["__nvmlVgpuInstanceGetFBCSessions"] = __nvmlVgpuInstanceGetFBCSessions + + global __nvmlVgpuInstanceGetGpuInstanceId + data["__nvmlVgpuInstanceGetGpuInstanceId"] = __nvmlVgpuInstanceGetGpuInstanceId + + global __nvmlVgpuInstanceGetGpuPciId + data["__nvmlVgpuInstanceGetGpuPciId"] = __nvmlVgpuInstanceGetGpuPciId + + global __nvmlVgpuTypeGetCapabilities + data["__nvmlVgpuTypeGetCapabilities"] = __nvmlVgpuTypeGetCapabilities + + global __nvmlVgpuInstanceGetMdevUUID + data["__nvmlVgpuInstanceGetMdevUUID"] = __nvmlVgpuInstanceGetMdevUUID + + global __nvmlGpuInstanceGetCreatableVgpus + data["__nvmlGpuInstanceGetCreatableVgpus"] = __nvmlGpuInstanceGetCreatableVgpus + + global __nvmlVgpuTypeGetMaxInstancesPerGpuInstance + data["__nvmlVgpuTypeGetMaxInstancesPerGpuInstance"] = __nvmlVgpuTypeGetMaxInstancesPerGpuInstance + + global __nvmlGpuInstanceGetActiveVgpus + data["__nvmlGpuInstanceGetActiveVgpus"] = __nvmlGpuInstanceGetActiveVgpus + + global __nvmlGpuInstanceSetVgpuSchedulerState + data["__nvmlGpuInstanceSetVgpuSchedulerState"] = __nvmlGpuInstanceSetVgpuSchedulerState + + global __nvmlGpuInstanceGetVgpuSchedulerState + data["__nvmlGpuInstanceGetVgpuSchedulerState"] = __nvmlGpuInstanceGetVgpuSchedulerState + + global __nvmlGpuInstanceGetVgpuSchedulerLog + data["__nvmlGpuInstanceGetVgpuSchedulerLog"] = __nvmlGpuInstanceGetVgpuSchedulerLog + + global __nvmlGpuInstanceGetVgpuTypeCreatablePlacements + data["__nvmlGpuInstanceGetVgpuTypeCreatablePlacements"] = __nvmlGpuInstanceGetVgpuTypeCreatablePlacements + + global __nvmlGpuInstanceGetVgpuHeterogeneousMode + data["__nvmlGpuInstanceGetVgpuHeterogeneousMode"] = __nvmlGpuInstanceGetVgpuHeterogeneousMode + + global __nvmlGpuInstanceSetVgpuHeterogeneousMode + data["__nvmlGpuInstanceSetVgpuHeterogeneousMode"] = __nvmlGpuInstanceSetVgpuHeterogeneousMode + + global __nvmlVgpuInstanceGetMetadata + data["__nvmlVgpuInstanceGetMetadata"] = __nvmlVgpuInstanceGetMetadata + + global __nvmlDeviceGetVgpuMetadata + data["__nvmlDeviceGetVgpuMetadata"] = __nvmlDeviceGetVgpuMetadata + + global __nvmlGetVgpuCompatibility + data["__nvmlGetVgpuCompatibility"] = __nvmlGetVgpuCompatibility + + global __nvmlDeviceGetPgpuMetadataString + data["__nvmlDeviceGetPgpuMetadataString"] = __nvmlDeviceGetPgpuMetadataString + + global __nvmlDeviceGetVgpuSchedulerLog + data["__nvmlDeviceGetVgpuSchedulerLog"] = __nvmlDeviceGetVgpuSchedulerLog + + global __nvmlDeviceGetVgpuSchedulerState + data["__nvmlDeviceGetVgpuSchedulerState"] = __nvmlDeviceGetVgpuSchedulerState + + global __nvmlDeviceGetVgpuSchedulerCapabilities + data["__nvmlDeviceGetVgpuSchedulerCapabilities"] = __nvmlDeviceGetVgpuSchedulerCapabilities + + global __nvmlDeviceSetVgpuSchedulerState + data["__nvmlDeviceSetVgpuSchedulerState"] = __nvmlDeviceSetVgpuSchedulerState + + global __nvmlGetVgpuVersion + data["__nvmlGetVgpuVersion"] = __nvmlGetVgpuVersion + + global __nvmlSetVgpuVersion + data["__nvmlSetVgpuVersion"] = __nvmlSetVgpuVersion + + global __nvmlDeviceGetVgpuUtilization + data["__nvmlDeviceGetVgpuUtilization"] = __nvmlDeviceGetVgpuUtilization + + global __nvmlDeviceGetVgpuInstancesUtilizationInfo + data["__nvmlDeviceGetVgpuInstancesUtilizationInfo"] = __nvmlDeviceGetVgpuInstancesUtilizationInfo + + global __nvmlDeviceGetVgpuProcessUtilization + data["__nvmlDeviceGetVgpuProcessUtilization"] = __nvmlDeviceGetVgpuProcessUtilization + + global __nvmlDeviceGetVgpuProcessesUtilizationInfo + data["__nvmlDeviceGetVgpuProcessesUtilizationInfo"] = __nvmlDeviceGetVgpuProcessesUtilizationInfo + + global __nvmlVgpuInstanceGetAccountingMode + data["__nvmlVgpuInstanceGetAccountingMode"] = __nvmlVgpuInstanceGetAccountingMode + + global __nvmlVgpuInstanceGetAccountingPids + data["__nvmlVgpuInstanceGetAccountingPids"] = __nvmlVgpuInstanceGetAccountingPids + + global __nvmlVgpuInstanceGetAccountingStats + data["__nvmlVgpuInstanceGetAccountingStats"] = __nvmlVgpuInstanceGetAccountingStats + + global __nvmlVgpuInstanceClearAccountingPids + data["__nvmlVgpuInstanceClearAccountingPids"] = __nvmlVgpuInstanceClearAccountingPids + + global __nvmlVgpuInstanceGetLicenseInfo_v2 + data["__nvmlVgpuInstanceGetLicenseInfo_v2"] = __nvmlVgpuInstanceGetLicenseInfo_v2 + + global __nvmlGetExcludedDeviceCount + data["__nvmlGetExcludedDeviceCount"] = __nvmlGetExcludedDeviceCount + + global __nvmlGetExcludedDeviceInfoByIndex + data["__nvmlGetExcludedDeviceInfoByIndex"] = __nvmlGetExcludedDeviceInfoByIndex + + global __nvmlDeviceSetMigMode + data["__nvmlDeviceSetMigMode"] = __nvmlDeviceSetMigMode + + global __nvmlDeviceGetMigMode + data["__nvmlDeviceGetMigMode"] = __nvmlDeviceGetMigMode + + global __nvmlDeviceGetGpuInstanceProfileInfoV + data["__nvmlDeviceGetGpuInstanceProfileInfoV"] = __nvmlDeviceGetGpuInstanceProfileInfoV + + global __nvmlDeviceGetGpuInstancePossiblePlacements_v2 + data["__nvmlDeviceGetGpuInstancePossiblePlacements_v2"] = __nvmlDeviceGetGpuInstancePossiblePlacements_v2 + + global __nvmlDeviceGetGpuInstanceRemainingCapacity + data["__nvmlDeviceGetGpuInstanceRemainingCapacity"] = __nvmlDeviceGetGpuInstanceRemainingCapacity + + global __nvmlDeviceCreateGpuInstance + data["__nvmlDeviceCreateGpuInstance"] = __nvmlDeviceCreateGpuInstance + + global __nvmlDeviceCreateGpuInstanceWithPlacement + data["__nvmlDeviceCreateGpuInstanceWithPlacement"] = __nvmlDeviceCreateGpuInstanceWithPlacement + + global __nvmlGpuInstanceDestroy + data["__nvmlGpuInstanceDestroy"] = __nvmlGpuInstanceDestroy + + global __nvmlDeviceGetGpuInstances + data["__nvmlDeviceGetGpuInstances"] = __nvmlDeviceGetGpuInstances + + global __nvmlDeviceGetGpuInstanceById + data["__nvmlDeviceGetGpuInstanceById"] = __nvmlDeviceGetGpuInstanceById + + global __nvmlGpuInstanceGetInfo + data["__nvmlGpuInstanceGetInfo"] = __nvmlGpuInstanceGetInfo + + global __nvmlGpuInstanceGetComputeInstanceProfileInfoV + data["__nvmlGpuInstanceGetComputeInstanceProfileInfoV"] = __nvmlGpuInstanceGetComputeInstanceProfileInfoV + + global __nvmlGpuInstanceGetComputeInstanceRemainingCapacity + data["__nvmlGpuInstanceGetComputeInstanceRemainingCapacity"] = __nvmlGpuInstanceGetComputeInstanceRemainingCapacity + + global __nvmlGpuInstanceGetComputeInstancePossiblePlacements + data["__nvmlGpuInstanceGetComputeInstancePossiblePlacements"] = __nvmlGpuInstanceGetComputeInstancePossiblePlacements + + global __nvmlGpuInstanceCreateComputeInstance + data["__nvmlGpuInstanceCreateComputeInstance"] = __nvmlGpuInstanceCreateComputeInstance + + global __nvmlGpuInstanceCreateComputeInstanceWithPlacement + data["__nvmlGpuInstanceCreateComputeInstanceWithPlacement"] = __nvmlGpuInstanceCreateComputeInstanceWithPlacement + + global __nvmlComputeInstanceDestroy + data["__nvmlComputeInstanceDestroy"] = __nvmlComputeInstanceDestroy + + global __nvmlGpuInstanceGetComputeInstances + data["__nvmlGpuInstanceGetComputeInstances"] = __nvmlGpuInstanceGetComputeInstances + + global __nvmlGpuInstanceGetComputeInstanceById + data["__nvmlGpuInstanceGetComputeInstanceById"] = __nvmlGpuInstanceGetComputeInstanceById + + global __nvmlComputeInstanceGetInfo_v2 + data["__nvmlComputeInstanceGetInfo_v2"] = __nvmlComputeInstanceGetInfo_v2 + + global __nvmlDeviceIsMigDeviceHandle + data["__nvmlDeviceIsMigDeviceHandle"] = __nvmlDeviceIsMigDeviceHandle + + global __nvmlDeviceGetGpuInstanceId + data["__nvmlDeviceGetGpuInstanceId"] = __nvmlDeviceGetGpuInstanceId + + global __nvmlDeviceGetComputeInstanceId + data["__nvmlDeviceGetComputeInstanceId"] = __nvmlDeviceGetComputeInstanceId + + global __nvmlDeviceGetMaxMigDeviceCount + data["__nvmlDeviceGetMaxMigDeviceCount"] = __nvmlDeviceGetMaxMigDeviceCount + + global __nvmlDeviceGetMigDeviceHandleByIndex + data["__nvmlDeviceGetMigDeviceHandleByIndex"] = __nvmlDeviceGetMigDeviceHandleByIndex + + global __nvmlDeviceGetDeviceHandleFromMigDeviceHandle + data["__nvmlDeviceGetDeviceHandleFromMigDeviceHandle"] = __nvmlDeviceGetDeviceHandleFromMigDeviceHandle + + global __nvmlGpmSampleGet + data["__nvmlGpmSampleGet"] = __nvmlGpmSampleGet + + global __nvmlGpmMigSampleGet + data["__nvmlGpmMigSampleGet"] = __nvmlGpmMigSampleGet + + global __nvmlGpmQueryDeviceSupport + data["__nvmlGpmQueryDeviceSupport"] = __nvmlGpmQueryDeviceSupport + + global __nvmlGpmQueryIfStreamingEnabled + data["__nvmlGpmQueryIfStreamingEnabled"] = __nvmlGpmQueryIfStreamingEnabled + + global __nvmlGpmSetStreamingEnabled + data["__nvmlGpmSetStreamingEnabled"] = __nvmlGpmSetStreamingEnabled + + global __nvmlDeviceGetCapabilities + data["__nvmlDeviceGetCapabilities"] = __nvmlDeviceGetCapabilities + + global __nvmlDeviceWorkloadPowerProfileClearRequestedProfiles + data["__nvmlDeviceWorkloadPowerProfileClearRequestedProfiles"] = __nvmlDeviceWorkloadPowerProfileClearRequestedProfiles + + global __nvmlDevicePowerSmoothingActivatePresetProfile + data["__nvmlDevicePowerSmoothingActivatePresetProfile"] = __nvmlDevicePowerSmoothingActivatePresetProfile + + global __nvmlDevicePowerSmoothingUpdatePresetProfileParam + data["__nvmlDevicePowerSmoothingUpdatePresetProfileParam"] = __nvmlDevicePowerSmoothingUpdatePresetProfileParam + + global __nvmlDevicePowerSmoothingSetState + data["__nvmlDevicePowerSmoothingSetState"] = __nvmlDevicePowerSmoothingSetState + + global __nvmlDeviceGetAddressingMode + data["__nvmlDeviceGetAddressingMode"] = __nvmlDeviceGetAddressingMode + + global __nvmlDeviceGetRepairStatus + data["__nvmlDeviceGetRepairStatus"] = __nvmlDeviceGetRepairStatus + + global __nvmlDeviceGetPowerMizerMode_v1 + data["__nvmlDeviceGetPowerMizerMode_v1"] = __nvmlDeviceGetPowerMizerMode_v1 + + global __nvmlDeviceSetPowerMizerMode_v1 + data["__nvmlDeviceSetPowerMizerMode_v1"] = __nvmlDeviceSetPowerMizerMode_v1 + + global __nvmlDeviceGetPdi + data["__nvmlDeviceGetPdi"] = __nvmlDeviceGetPdi + + global __nvmlDeviceSetHostname_v1 + data["__nvmlDeviceSetHostname_v1"] = __nvmlDeviceSetHostname_v1 + + global __nvmlDeviceGetHostname_v1 + data["__nvmlDeviceGetHostname_v1"] = __nvmlDeviceGetHostname_v1 + + global __nvmlDeviceGetNvLinkInfo + data["__nvmlDeviceGetNvLinkInfo"] = __nvmlDeviceGetNvLinkInfo + + global __nvmlDeviceReadWritePRM_v1 + data["__nvmlDeviceReadWritePRM_v1"] = __nvmlDeviceReadWritePRM_v1 + + global __nvmlDeviceGetGpuInstanceProfileInfoByIdV + data["__nvmlDeviceGetGpuInstanceProfileInfoByIdV"] = __nvmlDeviceGetGpuInstanceProfileInfoByIdV + + global __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts + data["__nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts"] = __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts + + func_ptrs = data + return data + + +cpdef _inspect_function_pointer(str name): + global func_ptrs + if func_ptrs is None: + func_ptrs = _inspect_function_pointers() + return func_ptrs[name] + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef nvmlReturn_t _nvmlInit_v2() except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlInit_v2 + _check_or_init_nvml() + if __nvmlInit_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlInit_v2 is not found") + return (__nvmlInit_v2)( + ) + + +cdef nvmlReturn_t _nvmlInitWithFlags(unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlInitWithFlags + _check_or_init_nvml() + if __nvmlInitWithFlags == NULL: + with gil: + raise FunctionNotFoundError("function nvmlInitWithFlags is not found") + return (__nvmlInitWithFlags)( + flags) + + +cdef nvmlReturn_t _nvmlShutdown() except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlShutdown + _check_or_init_nvml() + if __nvmlShutdown == NULL: + with gil: + raise FunctionNotFoundError("function nvmlShutdown is not found") + return (__nvmlShutdown)( + ) + + +cdef const char* _nvmlErrorString(nvmlReturn_t result) except?NULL nogil: + global __nvmlErrorString + _check_or_init_nvml() + if __nvmlErrorString == NULL: + with gil: + raise FunctionNotFoundError("function nvmlErrorString is not found") + return (__nvmlErrorString)( + result) + + +cdef nvmlReturn_t _nvmlSystemGetDriverVersion(char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetDriverVersion + _check_or_init_nvml() + if __nvmlSystemGetDriverVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetDriverVersion is not found") + return (__nvmlSystemGetDriverVersion)( + version, length) + + +cdef nvmlReturn_t _nvmlSystemGetNVMLVersion(char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetNVMLVersion + _check_or_init_nvml() + if __nvmlSystemGetNVMLVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetNVMLVersion is not found") + return (__nvmlSystemGetNVMLVersion)( + version, length) + + +cdef nvmlReturn_t _nvmlSystemGetCudaDriverVersion(int* cudaDriverVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetCudaDriverVersion + _check_or_init_nvml() + if __nvmlSystemGetCudaDriverVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetCudaDriverVersion is not found") + return (__nvmlSystemGetCudaDriverVersion)( + cudaDriverVersion) + + +cdef nvmlReturn_t _nvmlSystemGetCudaDriverVersion_v2(int* cudaDriverVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetCudaDriverVersion_v2 + _check_or_init_nvml() + if __nvmlSystemGetCudaDriverVersion_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetCudaDriverVersion_v2 is not found") + return (__nvmlSystemGetCudaDriverVersion_v2)( + cudaDriverVersion) + + +cdef nvmlReturn_t _nvmlSystemGetProcessName(unsigned int pid, char* name, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetProcessName + _check_or_init_nvml() + if __nvmlSystemGetProcessName == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetProcessName is not found") + return (__nvmlSystemGetProcessName)( + pid, name, length) + + +cdef nvmlReturn_t _nvmlSystemGetHicVersion(unsigned int* hwbcCount, nvmlHwbcEntry_t* hwbcEntries) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetHicVersion + _check_or_init_nvml() + if __nvmlSystemGetHicVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetHicVersion is not found") + return (__nvmlSystemGetHicVersion)( + hwbcCount, hwbcEntries) + + +cdef nvmlReturn_t _nvmlSystemGetTopologyGpuSet(unsigned int cpuNumber, unsigned int* count, nvmlDevice_t* deviceArray) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetTopologyGpuSet + _check_or_init_nvml() + if __nvmlSystemGetTopologyGpuSet == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetTopologyGpuSet is not found") + return (__nvmlSystemGetTopologyGpuSet)( + cpuNumber, count, deviceArray) + + +cdef nvmlReturn_t _nvmlSystemGetDriverBranch(nvmlSystemDriverBranchInfo_t* branchInfo, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetDriverBranch + _check_or_init_nvml() + if __nvmlSystemGetDriverBranch == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetDriverBranch is not found") + return (__nvmlSystemGetDriverBranch)( + branchInfo, length) + + +cdef nvmlReturn_t _nvmlUnitGetCount(unsigned int* unitCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetCount + _check_or_init_nvml() + if __nvmlUnitGetCount == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetCount is not found") + return (__nvmlUnitGetCount)( + unitCount) + + +cdef nvmlReturn_t _nvmlUnitGetHandleByIndex(unsigned int index, nvmlUnit_t* unit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetHandleByIndex + _check_or_init_nvml() + if __nvmlUnitGetHandleByIndex == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetHandleByIndex is not found") + return (__nvmlUnitGetHandleByIndex)( + index, unit) + + +cdef nvmlReturn_t _nvmlUnitGetUnitInfo(nvmlUnit_t unit, nvmlUnitInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetUnitInfo + _check_or_init_nvml() + if __nvmlUnitGetUnitInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetUnitInfo is not found") + return (__nvmlUnitGetUnitInfo)( + unit, info) + + +cdef nvmlReturn_t _nvmlUnitGetLedState(nvmlUnit_t unit, nvmlLedState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetLedState + _check_or_init_nvml() + if __nvmlUnitGetLedState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetLedState is not found") + return (__nvmlUnitGetLedState)( + unit, state) + + +cdef nvmlReturn_t _nvmlUnitGetPsuInfo(nvmlUnit_t unit, nvmlPSUInfo_t* psu) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetPsuInfo + _check_or_init_nvml() + if __nvmlUnitGetPsuInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetPsuInfo is not found") + return (__nvmlUnitGetPsuInfo)( + unit, psu) + + +cdef nvmlReturn_t _nvmlUnitGetTemperature(nvmlUnit_t unit, unsigned int type, unsigned int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetTemperature + _check_or_init_nvml() + if __nvmlUnitGetTemperature == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetTemperature is not found") + return (__nvmlUnitGetTemperature)( + unit, type, temp) + + +cdef nvmlReturn_t _nvmlUnitGetFanSpeedInfo(nvmlUnit_t unit, nvmlUnitFanSpeeds_t* fanSpeeds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetFanSpeedInfo + _check_or_init_nvml() + if __nvmlUnitGetFanSpeedInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetFanSpeedInfo is not found") + return (__nvmlUnitGetFanSpeedInfo)( + unit, fanSpeeds) + + +cdef nvmlReturn_t _nvmlUnitGetDevices(nvmlUnit_t unit, unsigned int* deviceCount, nvmlDevice_t* devices) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetDevices + _check_or_init_nvml() + if __nvmlUnitGetDevices == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetDevices is not found") + return (__nvmlUnitGetDevices)( + unit, deviceCount, devices) + + +cdef nvmlReturn_t _nvmlDeviceGetCount_v2(unsigned int* deviceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCount_v2 + _check_or_init_nvml() + if __nvmlDeviceGetCount_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCount_v2 is not found") + return (__nvmlDeviceGetCount_v2)( + deviceCount) + + +cdef nvmlReturn_t _nvmlDeviceGetAttributes_v2(nvmlDevice_t device, nvmlDeviceAttributes_t* attributes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAttributes_v2 + _check_or_init_nvml() + if __nvmlDeviceGetAttributes_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAttributes_v2 is not found") + return (__nvmlDeviceGetAttributes_v2)( + device, attributes) + + +cdef nvmlReturn_t _nvmlDeviceGetHandleByIndex_v2(unsigned int index, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHandleByIndex_v2 + _check_or_init_nvml() + if __nvmlDeviceGetHandleByIndex_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHandleByIndex_v2 is not found") + return (__nvmlDeviceGetHandleByIndex_v2)( + index, device) + + +cdef nvmlReturn_t _nvmlDeviceGetHandleBySerial(const char* serial, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHandleBySerial + _check_or_init_nvml() + if __nvmlDeviceGetHandleBySerial == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHandleBySerial is not found") + return (__nvmlDeviceGetHandleBySerial)( + serial, device) + + +cdef nvmlReturn_t _nvmlDeviceGetHandleByUUID(const char* uuid, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHandleByUUID + _check_or_init_nvml() + if __nvmlDeviceGetHandleByUUID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHandleByUUID is not found") + return (__nvmlDeviceGetHandleByUUID)( + uuid, device) + + +cdef nvmlReturn_t _nvmlDeviceGetHandleByUUIDV(const nvmlUUID_t* uuid, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHandleByUUIDV + _check_or_init_nvml() + if __nvmlDeviceGetHandleByUUIDV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHandleByUUIDV is not found") + return (__nvmlDeviceGetHandleByUUIDV)( + uuid, device) + + +cdef nvmlReturn_t _nvmlDeviceGetHandleByPciBusId_v2(const char* pciBusId, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHandleByPciBusId_v2 + _check_or_init_nvml() + if __nvmlDeviceGetHandleByPciBusId_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHandleByPciBusId_v2 is not found") + return (__nvmlDeviceGetHandleByPciBusId_v2)( + pciBusId, device) + + +cdef nvmlReturn_t _nvmlDeviceGetName(nvmlDevice_t device, char* name, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetName + _check_or_init_nvml() + if __nvmlDeviceGetName == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetName is not found") + return (__nvmlDeviceGetName)( + device, name, length) + + +cdef nvmlReturn_t _nvmlDeviceGetBrand(nvmlDevice_t device, nvmlBrandType_t* type) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBrand + _check_or_init_nvml() + if __nvmlDeviceGetBrand == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBrand is not found") + return (__nvmlDeviceGetBrand)( + device, type) + + +cdef nvmlReturn_t _nvmlDeviceGetIndex(nvmlDevice_t device, unsigned int* index) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetIndex + _check_or_init_nvml() + if __nvmlDeviceGetIndex == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetIndex is not found") + return (__nvmlDeviceGetIndex)( + device, index) + + +cdef nvmlReturn_t _nvmlDeviceGetSerial(nvmlDevice_t device, char* serial, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSerial + _check_or_init_nvml() + if __nvmlDeviceGetSerial == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSerial is not found") + return (__nvmlDeviceGetSerial)( + device, serial, length) + + +cdef nvmlReturn_t _nvmlDeviceGetModuleId(nvmlDevice_t device, unsigned int* moduleId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetModuleId + _check_or_init_nvml() + if __nvmlDeviceGetModuleId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetModuleId is not found") + return (__nvmlDeviceGetModuleId)( + device, moduleId) + + +cdef nvmlReturn_t _nvmlDeviceGetC2cModeInfoV(nvmlDevice_t device, nvmlC2cModeInfo_v1_t* c2cModeInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetC2cModeInfoV + _check_or_init_nvml() + if __nvmlDeviceGetC2cModeInfoV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetC2cModeInfoV is not found") + return (__nvmlDeviceGetC2cModeInfoV)( + device, c2cModeInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetMemoryAffinity(nvmlDevice_t device, unsigned int nodeSetSize, unsigned long* nodeSet, nvmlAffinityScope_t scope) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemoryAffinity + _check_or_init_nvml() + if __nvmlDeviceGetMemoryAffinity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemoryAffinity is not found") + return (__nvmlDeviceGetMemoryAffinity)( + device, nodeSetSize, nodeSet, scope) + + +cdef nvmlReturn_t _nvmlDeviceGetCpuAffinityWithinScope(nvmlDevice_t device, unsigned int cpuSetSize, unsigned long* cpuSet, nvmlAffinityScope_t scope) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCpuAffinityWithinScope + _check_or_init_nvml() + if __nvmlDeviceGetCpuAffinityWithinScope == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCpuAffinityWithinScope is not found") + return (__nvmlDeviceGetCpuAffinityWithinScope)( + device, cpuSetSize, cpuSet, scope) + + +cdef nvmlReturn_t _nvmlDeviceGetCpuAffinity(nvmlDevice_t device, unsigned int cpuSetSize, unsigned long* cpuSet) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCpuAffinity + _check_or_init_nvml() + if __nvmlDeviceGetCpuAffinity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCpuAffinity is not found") + return (__nvmlDeviceGetCpuAffinity)( + device, cpuSetSize, cpuSet) + + +cdef nvmlReturn_t _nvmlDeviceSetCpuAffinity(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetCpuAffinity + _check_or_init_nvml() + if __nvmlDeviceSetCpuAffinity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetCpuAffinity is not found") + return (__nvmlDeviceSetCpuAffinity)( + device) + + +cdef nvmlReturn_t _nvmlDeviceClearCpuAffinity(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceClearCpuAffinity + _check_or_init_nvml() + if __nvmlDeviceClearCpuAffinity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceClearCpuAffinity is not found") + return (__nvmlDeviceClearCpuAffinity)( + device) + + +cdef nvmlReturn_t _nvmlDeviceGetNumaNodeId(nvmlDevice_t device, unsigned int* node) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNumaNodeId + _check_or_init_nvml() + if __nvmlDeviceGetNumaNodeId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNumaNodeId is not found") + return (__nvmlDeviceGetNumaNodeId)( + device, node) + + +cdef nvmlReturn_t _nvmlDeviceGetTopologyCommonAncestor(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuTopologyLevel_t* pathInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTopologyCommonAncestor + _check_or_init_nvml() + if __nvmlDeviceGetTopologyCommonAncestor == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTopologyCommonAncestor is not found") + return (__nvmlDeviceGetTopologyCommonAncestor)( + device1, device2, pathInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetTopologyNearestGpus(nvmlDevice_t device, nvmlGpuTopologyLevel_t level, unsigned int* count, nvmlDevice_t* deviceArray) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTopologyNearestGpus + _check_or_init_nvml() + if __nvmlDeviceGetTopologyNearestGpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTopologyNearestGpus is not found") + return (__nvmlDeviceGetTopologyNearestGpus)( + device, level, count, deviceArray) + + +cdef nvmlReturn_t _nvmlDeviceGetP2PStatus(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuP2PCapsIndex_t p2pIndex, nvmlGpuP2PStatus_t* p2pStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetP2PStatus + _check_or_init_nvml() + if __nvmlDeviceGetP2PStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetP2PStatus is not found") + return (__nvmlDeviceGetP2PStatus)( + device1, device2, p2pIndex, p2pStatus) + + +cdef nvmlReturn_t _nvmlDeviceGetUUID(nvmlDevice_t device, char* uuid, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetUUID + _check_or_init_nvml() + if __nvmlDeviceGetUUID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetUUID is not found") + return (__nvmlDeviceGetUUID)( + device, uuid, length) + + +cdef nvmlReturn_t _nvmlDeviceGetMinorNumber(nvmlDevice_t device, unsigned int* minorNumber) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMinorNumber + _check_or_init_nvml() + if __nvmlDeviceGetMinorNumber == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMinorNumber is not found") + return (__nvmlDeviceGetMinorNumber)( + device, minorNumber) + + +cdef nvmlReturn_t _nvmlDeviceGetBoardPartNumber(nvmlDevice_t device, char* partNumber, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBoardPartNumber + _check_or_init_nvml() + if __nvmlDeviceGetBoardPartNumber == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBoardPartNumber is not found") + return (__nvmlDeviceGetBoardPartNumber)( + device, partNumber, length) + + +cdef nvmlReturn_t _nvmlDeviceGetInforomVersion(nvmlDevice_t device, nvmlInforomObject_t object, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetInforomVersion + _check_or_init_nvml() + if __nvmlDeviceGetInforomVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetInforomVersion is not found") + return (__nvmlDeviceGetInforomVersion)( + device, object, version, length) + + +cdef nvmlReturn_t _nvmlDeviceGetInforomImageVersion(nvmlDevice_t device, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetInforomImageVersion + _check_or_init_nvml() + if __nvmlDeviceGetInforomImageVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetInforomImageVersion is not found") + return (__nvmlDeviceGetInforomImageVersion)( + device, version, length) + + +cdef nvmlReturn_t _nvmlDeviceGetInforomConfigurationChecksum(nvmlDevice_t device, unsigned int* checksum) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetInforomConfigurationChecksum + _check_or_init_nvml() + if __nvmlDeviceGetInforomConfigurationChecksum == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetInforomConfigurationChecksum is not found") + return (__nvmlDeviceGetInforomConfigurationChecksum)( + device, checksum) + + +cdef nvmlReturn_t _nvmlDeviceValidateInforom(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceValidateInforom + _check_or_init_nvml() + if __nvmlDeviceValidateInforom == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceValidateInforom is not found") + return (__nvmlDeviceValidateInforom)( + device) + + +cdef nvmlReturn_t _nvmlDeviceGetLastBBXFlushTime(nvmlDevice_t device, unsigned long long* timestamp, unsigned long* durationUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetLastBBXFlushTime + _check_or_init_nvml() + if __nvmlDeviceGetLastBBXFlushTime == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetLastBBXFlushTime is not found") + return (__nvmlDeviceGetLastBBXFlushTime)( + device, timestamp, durationUs) + + +cdef nvmlReturn_t _nvmlDeviceGetDisplayMode(nvmlDevice_t device, nvmlEnableState_t* display) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDisplayMode + _check_or_init_nvml() + if __nvmlDeviceGetDisplayMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDisplayMode is not found") + return (__nvmlDeviceGetDisplayMode)( + device, display) + + +cdef nvmlReturn_t _nvmlDeviceGetDisplayActive(nvmlDevice_t device, nvmlEnableState_t* isActive) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDisplayActive + _check_or_init_nvml() + if __nvmlDeviceGetDisplayActive == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDisplayActive is not found") + return (__nvmlDeviceGetDisplayActive)( + device, isActive) + + +cdef nvmlReturn_t _nvmlDeviceGetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPersistenceMode + _check_or_init_nvml() + if __nvmlDeviceGetPersistenceMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPersistenceMode is not found") + return (__nvmlDeviceGetPersistenceMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceGetPciInfoExt(nvmlDevice_t device, nvmlPciInfoExt_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPciInfoExt + _check_or_init_nvml() + if __nvmlDeviceGetPciInfoExt == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPciInfoExt is not found") + return (__nvmlDeviceGetPciInfoExt)( + device, pci) + + +cdef nvmlReturn_t _nvmlDeviceGetPciInfo_v3(nvmlDevice_t device, nvmlPciInfo_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPciInfo_v3 + _check_or_init_nvml() + if __nvmlDeviceGetPciInfo_v3 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPciInfo_v3 is not found") + return (__nvmlDeviceGetPciInfo_v3)( + device, pci) + + +cdef nvmlReturn_t _nvmlDeviceGetMaxPcieLinkGeneration(nvmlDevice_t device, unsigned int* maxLinkGen) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMaxPcieLinkGeneration + _check_or_init_nvml() + if __nvmlDeviceGetMaxPcieLinkGeneration == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMaxPcieLinkGeneration is not found") + return (__nvmlDeviceGetMaxPcieLinkGeneration)( + device, maxLinkGen) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuMaxPcieLinkGeneration(nvmlDevice_t device, unsigned int* maxLinkGenDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuMaxPcieLinkGeneration + _check_or_init_nvml() + if __nvmlDeviceGetGpuMaxPcieLinkGeneration == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuMaxPcieLinkGeneration is not found") + return (__nvmlDeviceGetGpuMaxPcieLinkGeneration)( + device, maxLinkGenDevice) + + +cdef nvmlReturn_t _nvmlDeviceGetMaxPcieLinkWidth(nvmlDevice_t device, unsigned int* maxLinkWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMaxPcieLinkWidth + _check_or_init_nvml() + if __nvmlDeviceGetMaxPcieLinkWidth == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMaxPcieLinkWidth is not found") + return (__nvmlDeviceGetMaxPcieLinkWidth)( + device, maxLinkWidth) + + +cdef nvmlReturn_t _nvmlDeviceGetCurrPcieLinkGeneration(nvmlDevice_t device, unsigned int* currLinkGen) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCurrPcieLinkGeneration + _check_or_init_nvml() + if __nvmlDeviceGetCurrPcieLinkGeneration == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCurrPcieLinkGeneration is not found") + return (__nvmlDeviceGetCurrPcieLinkGeneration)( + device, currLinkGen) + + +cdef nvmlReturn_t _nvmlDeviceGetCurrPcieLinkWidth(nvmlDevice_t device, unsigned int* currLinkWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCurrPcieLinkWidth + _check_or_init_nvml() + if __nvmlDeviceGetCurrPcieLinkWidth == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCurrPcieLinkWidth is not found") + return (__nvmlDeviceGetCurrPcieLinkWidth)( + device, currLinkWidth) + + +cdef nvmlReturn_t _nvmlDeviceGetPcieThroughput(nvmlDevice_t device, nvmlPcieUtilCounter_t counter, unsigned int* value) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPcieThroughput + _check_or_init_nvml() + if __nvmlDeviceGetPcieThroughput == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPcieThroughput is not found") + return (__nvmlDeviceGetPcieThroughput)( + device, counter, value) + + +cdef nvmlReturn_t _nvmlDeviceGetPcieReplayCounter(nvmlDevice_t device, unsigned int* value) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPcieReplayCounter + _check_or_init_nvml() + if __nvmlDeviceGetPcieReplayCounter == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPcieReplayCounter is not found") + return (__nvmlDeviceGetPcieReplayCounter)( + device, value) + + +cdef nvmlReturn_t _nvmlDeviceGetClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetClockInfo + _check_or_init_nvml() + if __nvmlDeviceGetClockInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetClockInfo is not found") + return (__nvmlDeviceGetClockInfo)( + device, type, clock) + + +cdef nvmlReturn_t _nvmlDeviceGetMaxClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMaxClockInfo + _check_or_init_nvml() + if __nvmlDeviceGetMaxClockInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMaxClockInfo is not found") + return (__nvmlDeviceGetMaxClockInfo)( + device, type, clock) + + +cdef nvmlReturn_t _nvmlDeviceGetGpcClkVfOffset(nvmlDevice_t device, int* offset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpcClkVfOffset + _check_or_init_nvml() + if __nvmlDeviceGetGpcClkVfOffset == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpcClkVfOffset is not found") + return (__nvmlDeviceGetGpcClkVfOffset)( + device, offset) + + +cdef nvmlReturn_t _nvmlDeviceGetClock(nvmlDevice_t device, nvmlClockType_t clockType, nvmlClockId_t clockId, unsigned int* clockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetClock + _check_or_init_nvml() + if __nvmlDeviceGetClock == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetClock is not found") + return (__nvmlDeviceGetClock)( + device, clockType, clockId, clockMHz) + + +cdef nvmlReturn_t _nvmlDeviceGetMaxCustomerBoostClock(nvmlDevice_t device, nvmlClockType_t clockType, unsigned int* clockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMaxCustomerBoostClock + _check_or_init_nvml() + if __nvmlDeviceGetMaxCustomerBoostClock == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMaxCustomerBoostClock is not found") + return (__nvmlDeviceGetMaxCustomerBoostClock)( + device, clockType, clockMHz) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedMemoryClocks(nvmlDevice_t device, unsigned int* count, unsigned int* clocksMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedMemoryClocks + _check_or_init_nvml() + if __nvmlDeviceGetSupportedMemoryClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedMemoryClocks is not found") + return (__nvmlDeviceGetSupportedMemoryClocks)( + device, count, clocksMHz) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedGraphicsClocks(nvmlDevice_t device, unsigned int memoryClockMHz, unsigned int* count, unsigned int* clocksMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedGraphicsClocks + _check_or_init_nvml() + if __nvmlDeviceGetSupportedGraphicsClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedGraphicsClocks is not found") + return (__nvmlDeviceGetSupportedGraphicsClocks)( + device, memoryClockMHz, count, clocksMHz) + + +cdef nvmlReturn_t _nvmlDeviceGetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t* isEnabled, nvmlEnableState_t* defaultIsEnabled) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAutoBoostedClocksEnabled + _check_or_init_nvml() + if __nvmlDeviceGetAutoBoostedClocksEnabled == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAutoBoostedClocksEnabled is not found") + return (__nvmlDeviceGetAutoBoostedClocksEnabled)( + device, isEnabled, defaultIsEnabled) + + +cdef nvmlReturn_t _nvmlDeviceGetFanSpeed(nvmlDevice_t device, unsigned int* speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFanSpeed + _check_or_init_nvml() + if __nvmlDeviceGetFanSpeed == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFanSpeed is not found") + return (__nvmlDeviceGetFanSpeed)( + device, speed) + + +cdef nvmlReturn_t _nvmlDeviceGetFanSpeed_v2(nvmlDevice_t device, unsigned int fan, unsigned int* speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFanSpeed_v2 + _check_or_init_nvml() + if __nvmlDeviceGetFanSpeed_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFanSpeed_v2 is not found") + return (__nvmlDeviceGetFanSpeed_v2)( + device, fan, speed) + + +cdef nvmlReturn_t _nvmlDeviceGetFanSpeedRPM(nvmlDevice_t device, nvmlFanSpeedInfo_t* fanSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFanSpeedRPM + _check_or_init_nvml() + if __nvmlDeviceGetFanSpeedRPM == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFanSpeedRPM is not found") + return (__nvmlDeviceGetFanSpeedRPM)( + device, fanSpeed) + + +cdef nvmlReturn_t _nvmlDeviceGetTargetFanSpeed(nvmlDevice_t device, unsigned int fan, unsigned int* targetSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTargetFanSpeed + _check_or_init_nvml() + if __nvmlDeviceGetTargetFanSpeed == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTargetFanSpeed is not found") + return (__nvmlDeviceGetTargetFanSpeed)( + device, fan, targetSpeed) + + +cdef nvmlReturn_t _nvmlDeviceGetMinMaxFanSpeed(nvmlDevice_t device, unsigned int* minSpeed, unsigned int* maxSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMinMaxFanSpeed + _check_or_init_nvml() + if __nvmlDeviceGetMinMaxFanSpeed == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMinMaxFanSpeed is not found") + return (__nvmlDeviceGetMinMaxFanSpeed)( + device, minSpeed, maxSpeed) + + +cdef nvmlReturn_t _nvmlDeviceGetFanControlPolicy_v2(nvmlDevice_t device, unsigned int fan, nvmlFanControlPolicy_t* policy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFanControlPolicy_v2 + _check_or_init_nvml() + if __nvmlDeviceGetFanControlPolicy_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFanControlPolicy_v2 is not found") + return (__nvmlDeviceGetFanControlPolicy_v2)( + device, fan, policy) + + +cdef nvmlReturn_t _nvmlDeviceGetNumFans(nvmlDevice_t device, unsigned int* numFans) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNumFans + _check_or_init_nvml() + if __nvmlDeviceGetNumFans == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNumFans is not found") + return (__nvmlDeviceGetNumFans)( + device, numFans) + + +cdef nvmlReturn_t _nvmlDeviceGetCoolerInfo(nvmlDevice_t device, nvmlCoolerInfo_t* coolerInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCoolerInfo + _check_or_init_nvml() + if __nvmlDeviceGetCoolerInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCoolerInfo is not found") + return (__nvmlDeviceGetCoolerInfo)( + device, coolerInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetTemperatureV(nvmlDevice_t device, nvmlTemperature_t* temperature) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTemperatureV + _check_or_init_nvml() + if __nvmlDeviceGetTemperatureV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTemperatureV is not found") + return (__nvmlDeviceGetTemperatureV)( + device, temperature) + + +cdef nvmlReturn_t _nvmlDeviceGetTemperatureThreshold(nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, unsigned int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTemperatureThreshold + _check_or_init_nvml() + if __nvmlDeviceGetTemperatureThreshold == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTemperatureThreshold is not found") + return (__nvmlDeviceGetTemperatureThreshold)( + device, thresholdType, temp) + + +cdef nvmlReturn_t _nvmlDeviceGetMarginTemperature(nvmlDevice_t device, nvmlMarginTemperature_t* marginTempInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMarginTemperature + _check_or_init_nvml() + if __nvmlDeviceGetMarginTemperature == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMarginTemperature is not found") + return (__nvmlDeviceGetMarginTemperature)( + device, marginTempInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetThermalSettings(nvmlDevice_t device, unsigned int sensorIndex, nvmlGpuThermalSettings_t* pThermalSettings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetThermalSettings + _check_or_init_nvml() + if __nvmlDeviceGetThermalSettings == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetThermalSettings is not found") + return (__nvmlDeviceGetThermalSettings)( + device, sensorIndex, pThermalSettings) + + +cdef nvmlReturn_t _nvmlDeviceGetPerformanceState(nvmlDevice_t device, nvmlPstates_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPerformanceState + _check_or_init_nvml() + if __nvmlDeviceGetPerformanceState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPerformanceState is not found") + return (__nvmlDeviceGetPerformanceState)( + device, pState) + + +cdef nvmlReturn_t _nvmlDeviceGetCurrentClocksEventReasons(nvmlDevice_t device, unsigned long long* clocksEventReasons) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCurrentClocksEventReasons + _check_or_init_nvml() + if __nvmlDeviceGetCurrentClocksEventReasons == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCurrentClocksEventReasons is not found") + return (__nvmlDeviceGetCurrentClocksEventReasons)( + device, clocksEventReasons) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedClocksEventReasons(nvmlDevice_t device, unsigned long long* supportedClocksEventReasons) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedClocksEventReasons + _check_or_init_nvml() + if __nvmlDeviceGetSupportedClocksEventReasons == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedClocksEventReasons is not found") + return (__nvmlDeviceGetSupportedClocksEventReasons)( + device, supportedClocksEventReasons) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerState(nvmlDevice_t device, nvmlPstates_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerState + _check_or_init_nvml() + if __nvmlDeviceGetPowerState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerState is not found") + return (__nvmlDeviceGetPowerState)( + device, pState) + + +cdef nvmlReturn_t _nvmlDeviceGetDynamicPstatesInfo(nvmlDevice_t device, nvmlGpuDynamicPstatesInfo_t* pDynamicPstatesInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDynamicPstatesInfo + _check_or_init_nvml() + if __nvmlDeviceGetDynamicPstatesInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDynamicPstatesInfo is not found") + return (__nvmlDeviceGetDynamicPstatesInfo)( + device, pDynamicPstatesInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetMemClkVfOffset(nvmlDevice_t device, int* offset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemClkVfOffset + _check_or_init_nvml() + if __nvmlDeviceGetMemClkVfOffset == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemClkVfOffset is not found") + return (__nvmlDeviceGetMemClkVfOffset)( + device, offset) + + +cdef nvmlReturn_t _nvmlDeviceGetMinMaxClockOfPState(nvmlDevice_t device, nvmlClockType_t type, nvmlPstates_t pstate, unsigned int* minClockMHz, unsigned int* maxClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMinMaxClockOfPState + _check_or_init_nvml() + if __nvmlDeviceGetMinMaxClockOfPState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMinMaxClockOfPState is not found") + return (__nvmlDeviceGetMinMaxClockOfPState)( + device, type, pstate, minClockMHz, maxClockMHz) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedPerformanceStates(nvmlDevice_t device, nvmlPstates_t* pstates, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedPerformanceStates + _check_or_init_nvml() + if __nvmlDeviceGetSupportedPerformanceStates == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedPerformanceStates is not found") + return (__nvmlDeviceGetSupportedPerformanceStates)( + device, pstates, size) + + +cdef nvmlReturn_t _nvmlDeviceGetGpcClkMinMaxVfOffset(nvmlDevice_t device, int* minOffset, int* maxOffset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpcClkMinMaxVfOffset + _check_or_init_nvml() + if __nvmlDeviceGetGpcClkMinMaxVfOffset == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpcClkMinMaxVfOffset is not found") + return (__nvmlDeviceGetGpcClkMinMaxVfOffset)( + device, minOffset, maxOffset) + + +cdef nvmlReturn_t _nvmlDeviceGetMemClkMinMaxVfOffset(nvmlDevice_t device, int* minOffset, int* maxOffset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemClkMinMaxVfOffset + _check_or_init_nvml() + if __nvmlDeviceGetMemClkMinMaxVfOffset == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemClkMinMaxVfOffset is not found") + return (__nvmlDeviceGetMemClkMinMaxVfOffset)( + device, minOffset, maxOffset) + + +cdef nvmlReturn_t _nvmlDeviceGetClockOffsets(nvmlDevice_t device, nvmlClockOffset_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetClockOffsets + _check_or_init_nvml() + if __nvmlDeviceGetClockOffsets == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetClockOffsets is not found") + return (__nvmlDeviceGetClockOffsets)( + device, info) + + +cdef nvmlReturn_t _nvmlDeviceSetClockOffsets(nvmlDevice_t device, nvmlClockOffset_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetClockOffsets + _check_or_init_nvml() + if __nvmlDeviceSetClockOffsets == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetClockOffsets is not found") + return (__nvmlDeviceSetClockOffsets)( + device, info) + + +cdef nvmlReturn_t _nvmlDeviceGetPerformanceModes(nvmlDevice_t device, nvmlDevicePerfModes_t* perfModes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPerformanceModes + _check_or_init_nvml() + if __nvmlDeviceGetPerformanceModes == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPerformanceModes is not found") + return (__nvmlDeviceGetPerformanceModes)( + device, perfModes) + + +cdef nvmlReturn_t _nvmlDeviceGetCurrentClockFreqs(nvmlDevice_t device, nvmlDeviceCurrentClockFreqs_t* currentClockFreqs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCurrentClockFreqs + _check_or_init_nvml() + if __nvmlDeviceGetCurrentClockFreqs == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCurrentClockFreqs is not found") + return (__nvmlDeviceGetCurrentClockFreqs)( + device, currentClockFreqs) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerManagementLimit(nvmlDevice_t device, unsigned int* limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerManagementLimit + _check_or_init_nvml() + if __nvmlDeviceGetPowerManagementLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerManagementLimit is not found") + return (__nvmlDeviceGetPowerManagementLimit)( + device, limit) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerManagementLimitConstraints(nvmlDevice_t device, unsigned int* minLimit, unsigned int* maxLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerManagementLimitConstraints + _check_or_init_nvml() + if __nvmlDeviceGetPowerManagementLimitConstraints == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerManagementLimitConstraints is not found") + return (__nvmlDeviceGetPowerManagementLimitConstraints)( + device, minLimit, maxLimit) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerManagementDefaultLimit(nvmlDevice_t device, unsigned int* defaultLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerManagementDefaultLimit + _check_or_init_nvml() + if __nvmlDeviceGetPowerManagementDefaultLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerManagementDefaultLimit is not found") + return (__nvmlDeviceGetPowerManagementDefaultLimit)( + device, defaultLimit) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerUsage(nvmlDevice_t device, unsigned int* power) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerUsage + _check_or_init_nvml() + if __nvmlDeviceGetPowerUsage == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerUsage is not found") + return (__nvmlDeviceGetPowerUsage)( + device, power) + + +cdef nvmlReturn_t _nvmlDeviceGetTotalEnergyConsumption(nvmlDevice_t device, unsigned long long* energy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTotalEnergyConsumption + _check_or_init_nvml() + if __nvmlDeviceGetTotalEnergyConsumption == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTotalEnergyConsumption is not found") + return (__nvmlDeviceGetTotalEnergyConsumption)( + device, energy) + + +cdef nvmlReturn_t _nvmlDeviceGetEnforcedPowerLimit(nvmlDevice_t device, unsigned int* limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEnforcedPowerLimit + _check_or_init_nvml() + if __nvmlDeviceGetEnforcedPowerLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEnforcedPowerLimit is not found") + return (__nvmlDeviceGetEnforcedPowerLimit)( + device, limit) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t* current, nvmlGpuOperationMode_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuOperationMode + _check_or_init_nvml() + if __nvmlDeviceGetGpuOperationMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuOperationMode is not found") + return (__nvmlDeviceGetGpuOperationMode)( + device, current, pending) + + +cdef nvmlReturn_t _nvmlDeviceGetMemoryInfo_v2(nvmlDevice_t device, nvmlMemory_v2_t* memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemoryInfo_v2 + _check_or_init_nvml() + if __nvmlDeviceGetMemoryInfo_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemoryInfo_v2 is not found") + return (__nvmlDeviceGetMemoryInfo_v2)( + device, memory) + + +cdef nvmlReturn_t _nvmlDeviceGetComputeMode(nvmlDevice_t device, nvmlComputeMode_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetComputeMode + _check_or_init_nvml() + if __nvmlDeviceGetComputeMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetComputeMode is not found") + return (__nvmlDeviceGetComputeMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceGetCudaComputeCapability(nvmlDevice_t device, int* major, int* minor) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCudaComputeCapability + _check_or_init_nvml() + if __nvmlDeviceGetCudaComputeCapability == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCudaComputeCapability is not found") + return (__nvmlDeviceGetCudaComputeCapability)( + device, major, minor) + + +cdef nvmlReturn_t _nvmlDeviceGetDramEncryptionMode(nvmlDevice_t device, nvmlDramEncryptionInfo_t* current, nvmlDramEncryptionInfo_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDramEncryptionMode + _check_or_init_nvml() + if __nvmlDeviceGetDramEncryptionMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDramEncryptionMode is not found") + return (__nvmlDeviceGetDramEncryptionMode)( + device, current, pending) + + +cdef nvmlReturn_t _nvmlDeviceSetDramEncryptionMode(nvmlDevice_t device, const nvmlDramEncryptionInfo_t* dramEncryption) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetDramEncryptionMode + _check_or_init_nvml() + if __nvmlDeviceSetDramEncryptionMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetDramEncryptionMode is not found") + return (__nvmlDeviceSetDramEncryptionMode)( + device, dramEncryption) + + +cdef nvmlReturn_t _nvmlDeviceGetEccMode(nvmlDevice_t device, nvmlEnableState_t* current, nvmlEnableState_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEccMode + _check_or_init_nvml() + if __nvmlDeviceGetEccMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEccMode is not found") + return (__nvmlDeviceGetEccMode)( + device, current, pending) + + +cdef nvmlReturn_t _nvmlDeviceGetDefaultEccMode(nvmlDevice_t device, nvmlEnableState_t* defaultMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDefaultEccMode + _check_or_init_nvml() + if __nvmlDeviceGetDefaultEccMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDefaultEccMode is not found") + return (__nvmlDeviceGetDefaultEccMode)( + device, defaultMode) + + +cdef nvmlReturn_t _nvmlDeviceGetBoardId(nvmlDevice_t device, unsigned int* boardId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBoardId + _check_or_init_nvml() + if __nvmlDeviceGetBoardId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBoardId is not found") + return (__nvmlDeviceGetBoardId)( + device, boardId) + + +cdef nvmlReturn_t _nvmlDeviceGetMultiGpuBoard(nvmlDevice_t device, unsigned int* multiGpuBool) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMultiGpuBoard + _check_or_init_nvml() + if __nvmlDeviceGetMultiGpuBoard == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMultiGpuBoard is not found") + return (__nvmlDeviceGetMultiGpuBoard)( + device, multiGpuBool) + + +cdef nvmlReturn_t _nvmlDeviceGetTotalEccErrors(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, unsigned long long* eccCounts) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTotalEccErrors + _check_or_init_nvml() + if __nvmlDeviceGetTotalEccErrors == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTotalEccErrors is not found") + return (__nvmlDeviceGetTotalEccErrors)( + device, errorType, counterType, eccCounts) + + +cdef nvmlReturn_t _nvmlDeviceGetMemoryErrorCounter(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, nvmlMemoryLocation_t locationType, unsigned long long* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemoryErrorCounter + _check_or_init_nvml() + if __nvmlDeviceGetMemoryErrorCounter == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemoryErrorCounter is not found") + return (__nvmlDeviceGetMemoryErrorCounter)( + device, errorType, counterType, locationType, count) + + +cdef nvmlReturn_t _nvmlDeviceGetUtilizationRates(nvmlDevice_t device, nvmlUtilization_t* utilization) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetUtilizationRates + _check_or_init_nvml() + if __nvmlDeviceGetUtilizationRates == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetUtilizationRates is not found") + return (__nvmlDeviceGetUtilizationRates)( + device, utilization) + + +cdef nvmlReturn_t _nvmlDeviceGetEncoderUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEncoderUtilization + _check_or_init_nvml() + if __nvmlDeviceGetEncoderUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEncoderUtilization is not found") + return (__nvmlDeviceGetEncoderUtilization)( + device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t _nvmlDeviceGetEncoderCapacity(nvmlDevice_t device, nvmlEncoderType_t encoderQueryType, unsigned int* encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEncoderCapacity + _check_or_init_nvml() + if __nvmlDeviceGetEncoderCapacity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEncoderCapacity is not found") + return (__nvmlDeviceGetEncoderCapacity)( + device, encoderQueryType, encoderCapacity) + + +cdef nvmlReturn_t _nvmlDeviceGetEncoderStats(nvmlDevice_t device, unsigned int* sessionCount, unsigned int* averageFps, unsigned int* averageLatency) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEncoderStats + _check_or_init_nvml() + if __nvmlDeviceGetEncoderStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEncoderStats is not found") + return (__nvmlDeviceGetEncoderStats)( + device, sessionCount, averageFps, averageLatency) + + +cdef nvmlReturn_t _nvmlDeviceGetEncoderSessions(nvmlDevice_t device, unsigned int* sessionCount, nvmlEncoderSessionInfo_t* sessionInfos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEncoderSessions + _check_or_init_nvml() + if __nvmlDeviceGetEncoderSessions == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEncoderSessions is not found") + return (__nvmlDeviceGetEncoderSessions)( + device, sessionCount, sessionInfos) + + +cdef nvmlReturn_t _nvmlDeviceGetDecoderUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDecoderUtilization + _check_or_init_nvml() + if __nvmlDeviceGetDecoderUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDecoderUtilization is not found") + return (__nvmlDeviceGetDecoderUtilization)( + device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t _nvmlDeviceGetJpgUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetJpgUtilization + _check_or_init_nvml() + if __nvmlDeviceGetJpgUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetJpgUtilization is not found") + return (__nvmlDeviceGetJpgUtilization)( + device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t _nvmlDeviceGetOfaUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetOfaUtilization + _check_or_init_nvml() + if __nvmlDeviceGetOfaUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetOfaUtilization is not found") + return (__nvmlDeviceGetOfaUtilization)( + device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t _nvmlDeviceGetFBCStats(nvmlDevice_t device, nvmlFBCStats_t* fbcStats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFBCStats + _check_or_init_nvml() + if __nvmlDeviceGetFBCStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFBCStats is not found") + return (__nvmlDeviceGetFBCStats)( + device, fbcStats) + + +cdef nvmlReturn_t _nvmlDeviceGetFBCSessions(nvmlDevice_t device, unsigned int* sessionCount, nvmlFBCSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFBCSessions + _check_or_init_nvml() + if __nvmlDeviceGetFBCSessions == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFBCSessions is not found") + return (__nvmlDeviceGetFBCSessions)( + device, sessionCount, sessionInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetDriverModel_v2(nvmlDevice_t device, nvmlDriverModel_t* current, nvmlDriverModel_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDriverModel_v2 + _check_or_init_nvml() + if __nvmlDeviceGetDriverModel_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDriverModel_v2 is not found") + return (__nvmlDeviceGetDriverModel_v2)( + device, current, pending) + + +cdef nvmlReturn_t _nvmlDeviceGetVbiosVersion(nvmlDevice_t device, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVbiosVersion + _check_or_init_nvml() + if __nvmlDeviceGetVbiosVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVbiosVersion is not found") + return (__nvmlDeviceGetVbiosVersion)( + device, version, length) + + +cdef nvmlReturn_t _nvmlDeviceGetBridgeChipInfo(nvmlDevice_t device, nvmlBridgeChipHierarchy_t* bridgeHierarchy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBridgeChipInfo + _check_or_init_nvml() + if __nvmlDeviceGetBridgeChipInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBridgeChipInfo is not found") + return (__nvmlDeviceGetBridgeChipInfo)( + device, bridgeHierarchy) + + +cdef nvmlReturn_t _nvmlDeviceGetComputeRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetComputeRunningProcesses_v3 + _check_or_init_nvml() + if __nvmlDeviceGetComputeRunningProcesses_v3 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetComputeRunningProcesses_v3 is not found") + return (__nvmlDeviceGetComputeRunningProcesses_v3)( + device, infoCount, infos) + + +cdef nvmlReturn_t _nvmlDeviceGetGraphicsRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGraphicsRunningProcesses_v3 + _check_or_init_nvml() + if __nvmlDeviceGetGraphicsRunningProcesses_v3 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGraphicsRunningProcesses_v3 is not found") + return (__nvmlDeviceGetGraphicsRunningProcesses_v3)( + device, infoCount, infos) + + +cdef nvmlReturn_t _nvmlDeviceGetMPSComputeRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMPSComputeRunningProcesses_v3 + _check_or_init_nvml() + if __nvmlDeviceGetMPSComputeRunningProcesses_v3 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMPSComputeRunningProcesses_v3 is not found") + return (__nvmlDeviceGetMPSComputeRunningProcesses_v3)( + device, infoCount, infos) + + +cdef nvmlReturn_t _nvmlDeviceGetRunningProcessDetailList(nvmlDevice_t device, nvmlProcessDetailList_t* plist) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRunningProcessDetailList + _check_or_init_nvml() + if __nvmlDeviceGetRunningProcessDetailList == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRunningProcessDetailList is not found") + return (__nvmlDeviceGetRunningProcessDetailList)( + device, plist) + + +cdef nvmlReturn_t _nvmlDeviceOnSameBoard(nvmlDevice_t device1, nvmlDevice_t device2, int* onSameBoard) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceOnSameBoard + _check_or_init_nvml() + if __nvmlDeviceOnSameBoard == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceOnSameBoard is not found") + return (__nvmlDeviceOnSameBoard)( + device1, device2, onSameBoard) + + +cdef nvmlReturn_t _nvmlDeviceGetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t* isRestricted) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAPIRestriction + _check_or_init_nvml() + if __nvmlDeviceGetAPIRestriction == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAPIRestriction is not found") + return (__nvmlDeviceGetAPIRestriction)( + device, apiType, isRestricted) + + +cdef nvmlReturn_t _nvmlDeviceGetSamples(nvmlDevice_t device, nvmlSamplingType_t type, unsigned long long lastSeenTimeStamp, nvmlValueType_t* sampleValType, unsigned int* sampleCount, nvmlSample_t* samples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSamples + _check_or_init_nvml() + if __nvmlDeviceGetSamples == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSamples is not found") + return (__nvmlDeviceGetSamples)( + device, type, lastSeenTimeStamp, sampleValType, sampleCount, samples) + + +cdef nvmlReturn_t _nvmlDeviceGetBAR1MemoryInfo(nvmlDevice_t device, nvmlBAR1Memory_t* bar1Memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBAR1MemoryInfo + _check_or_init_nvml() + if __nvmlDeviceGetBAR1MemoryInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBAR1MemoryInfo is not found") + return (__nvmlDeviceGetBAR1MemoryInfo)( + device, bar1Memory) + + +cdef nvmlReturn_t _nvmlDeviceGetIrqNum(nvmlDevice_t device, unsigned int* irqNum) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetIrqNum + _check_or_init_nvml() + if __nvmlDeviceGetIrqNum == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetIrqNum is not found") + return (__nvmlDeviceGetIrqNum)( + device, irqNum) + + +cdef nvmlReturn_t _nvmlDeviceGetNumGpuCores(nvmlDevice_t device, unsigned int* numCores) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNumGpuCores + _check_or_init_nvml() + if __nvmlDeviceGetNumGpuCores == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNumGpuCores is not found") + return (__nvmlDeviceGetNumGpuCores)( + device, numCores) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerSource(nvmlDevice_t device, nvmlPowerSource_t* powerSource) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerSource + _check_or_init_nvml() + if __nvmlDeviceGetPowerSource == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerSource is not found") + return (__nvmlDeviceGetPowerSource)( + device, powerSource) + + +cdef nvmlReturn_t _nvmlDeviceGetMemoryBusWidth(nvmlDevice_t device, unsigned int* busWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemoryBusWidth + _check_or_init_nvml() + if __nvmlDeviceGetMemoryBusWidth == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemoryBusWidth is not found") + return (__nvmlDeviceGetMemoryBusWidth)( + device, busWidth) + + +cdef nvmlReturn_t _nvmlDeviceGetPcieLinkMaxSpeed(nvmlDevice_t device, unsigned int* maxSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPcieLinkMaxSpeed + _check_or_init_nvml() + if __nvmlDeviceGetPcieLinkMaxSpeed == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPcieLinkMaxSpeed is not found") + return (__nvmlDeviceGetPcieLinkMaxSpeed)( + device, maxSpeed) + + +cdef nvmlReturn_t _nvmlDeviceGetPcieSpeed(nvmlDevice_t device, unsigned int* pcieSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPcieSpeed + _check_or_init_nvml() + if __nvmlDeviceGetPcieSpeed == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPcieSpeed is not found") + return (__nvmlDeviceGetPcieSpeed)( + device, pcieSpeed) + + +cdef nvmlReturn_t _nvmlDeviceGetAdaptiveClockInfoStatus(nvmlDevice_t device, unsigned int* adaptiveClockStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAdaptiveClockInfoStatus + _check_or_init_nvml() + if __nvmlDeviceGetAdaptiveClockInfoStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAdaptiveClockInfoStatus is not found") + return (__nvmlDeviceGetAdaptiveClockInfoStatus)( + device, adaptiveClockStatus) + + +cdef nvmlReturn_t _nvmlDeviceGetBusType(nvmlDevice_t device, nvmlBusType_t* type) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBusType + _check_or_init_nvml() + if __nvmlDeviceGetBusType == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBusType is not found") + return (__nvmlDeviceGetBusType)( + device, type) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuFabricInfoV(nvmlDevice_t device, nvmlGpuFabricInfoV_t* gpuFabricInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuFabricInfoV + _check_or_init_nvml() + if __nvmlDeviceGetGpuFabricInfoV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuFabricInfoV is not found") + return (__nvmlDeviceGetGpuFabricInfoV)( + device, gpuFabricInfo) + + +cdef nvmlReturn_t _nvmlSystemGetConfComputeCapabilities(nvmlConfComputeSystemCaps_t* capabilities) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetConfComputeCapabilities + _check_or_init_nvml() + if __nvmlSystemGetConfComputeCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetConfComputeCapabilities is not found") + return (__nvmlSystemGetConfComputeCapabilities)( + capabilities) + + +cdef nvmlReturn_t _nvmlSystemGetConfComputeState(nvmlConfComputeSystemState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetConfComputeState + _check_or_init_nvml() + if __nvmlSystemGetConfComputeState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetConfComputeState is not found") + return (__nvmlSystemGetConfComputeState)( + state) + + +cdef nvmlReturn_t _nvmlDeviceGetConfComputeMemSizeInfo(nvmlDevice_t device, nvmlConfComputeMemSizeInfo_t* memInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetConfComputeMemSizeInfo + _check_or_init_nvml() + if __nvmlDeviceGetConfComputeMemSizeInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetConfComputeMemSizeInfo is not found") + return (__nvmlDeviceGetConfComputeMemSizeInfo)( + device, memInfo) + + +cdef nvmlReturn_t _nvmlSystemGetConfComputeGpusReadyState(unsigned int* isAcceptingWork) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetConfComputeGpusReadyState + _check_or_init_nvml() + if __nvmlSystemGetConfComputeGpusReadyState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetConfComputeGpusReadyState is not found") + return (__nvmlSystemGetConfComputeGpusReadyState)( + isAcceptingWork) + + +cdef nvmlReturn_t _nvmlDeviceGetConfComputeProtectedMemoryUsage(nvmlDevice_t device, nvmlMemory_t* memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetConfComputeProtectedMemoryUsage + _check_or_init_nvml() + if __nvmlDeviceGetConfComputeProtectedMemoryUsage == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetConfComputeProtectedMemoryUsage is not found") + return (__nvmlDeviceGetConfComputeProtectedMemoryUsage)( + device, memory) + + +cdef nvmlReturn_t _nvmlDeviceGetConfComputeGpuCertificate(nvmlDevice_t device, nvmlConfComputeGpuCertificate_t* gpuCert) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetConfComputeGpuCertificate + _check_or_init_nvml() + if __nvmlDeviceGetConfComputeGpuCertificate == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetConfComputeGpuCertificate is not found") + return (__nvmlDeviceGetConfComputeGpuCertificate)( + device, gpuCert) + + +cdef nvmlReturn_t _nvmlDeviceGetConfComputeGpuAttestationReport(nvmlDevice_t device, nvmlConfComputeGpuAttestationReport_t* gpuAtstReport) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetConfComputeGpuAttestationReport + _check_or_init_nvml() + if __nvmlDeviceGetConfComputeGpuAttestationReport == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetConfComputeGpuAttestationReport is not found") + return (__nvmlDeviceGetConfComputeGpuAttestationReport)( + device, gpuAtstReport) + + +cdef nvmlReturn_t _nvmlSystemGetConfComputeKeyRotationThresholdInfo(nvmlConfComputeGetKeyRotationThresholdInfo_t* pKeyRotationThrInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetConfComputeKeyRotationThresholdInfo + _check_or_init_nvml() + if __nvmlSystemGetConfComputeKeyRotationThresholdInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetConfComputeKeyRotationThresholdInfo is not found") + return (__nvmlSystemGetConfComputeKeyRotationThresholdInfo)( + pKeyRotationThrInfo) + + +cdef nvmlReturn_t _nvmlDeviceSetConfComputeUnprotectedMemSize(nvmlDevice_t device, unsigned long long sizeKiB) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetConfComputeUnprotectedMemSize + _check_or_init_nvml() + if __nvmlDeviceSetConfComputeUnprotectedMemSize == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetConfComputeUnprotectedMemSize is not found") + return (__nvmlDeviceSetConfComputeUnprotectedMemSize)( + device, sizeKiB) + + +cdef nvmlReturn_t _nvmlSystemSetConfComputeGpusReadyState(unsigned int isAcceptingWork) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemSetConfComputeGpusReadyState + _check_or_init_nvml() + if __nvmlSystemSetConfComputeGpusReadyState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemSetConfComputeGpusReadyState is not found") + return (__nvmlSystemSetConfComputeGpusReadyState)( + isAcceptingWork) + + +cdef nvmlReturn_t _nvmlSystemSetConfComputeKeyRotationThresholdInfo(nvmlConfComputeSetKeyRotationThresholdInfo_t* pKeyRotationThrInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemSetConfComputeKeyRotationThresholdInfo + _check_or_init_nvml() + if __nvmlSystemSetConfComputeKeyRotationThresholdInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemSetConfComputeKeyRotationThresholdInfo is not found") + return (__nvmlSystemSetConfComputeKeyRotationThresholdInfo)( + pKeyRotationThrInfo) + + +cdef nvmlReturn_t _nvmlSystemGetConfComputeSettings(nvmlSystemConfComputeSettings_t* settings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetConfComputeSettings + _check_or_init_nvml() + if __nvmlSystemGetConfComputeSettings == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetConfComputeSettings is not found") + return (__nvmlSystemGetConfComputeSettings)( + settings) + + +cdef nvmlReturn_t _nvmlDeviceGetGspFirmwareVersion(nvmlDevice_t device, char* version) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGspFirmwareVersion + _check_or_init_nvml() + if __nvmlDeviceGetGspFirmwareVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGspFirmwareVersion is not found") + return (__nvmlDeviceGetGspFirmwareVersion)( + device, version) + + +cdef nvmlReturn_t _nvmlDeviceGetGspFirmwareMode(nvmlDevice_t device, unsigned int* isEnabled, unsigned int* defaultMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGspFirmwareMode + _check_or_init_nvml() + if __nvmlDeviceGetGspFirmwareMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGspFirmwareMode is not found") + return (__nvmlDeviceGetGspFirmwareMode)( + device, isEnabled, defaultMode) + + +cdef nvmlReturn_t _nvmlDeviceGetSramEccErrorStatus(nvmlDevice_t device, nvmlEccSramErrorStatus_t* status) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSramEccErrorStatus + _check_or_init_nvml() + if __nvmlDeviceGetSramEccErrorStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSramEccErrorStatus is not found") + return (__nvmlDeviceGetSramEccErrorStatus)( + device, status) + + +cdef nvmlReturn_t _nvmlDeviceGetAccountingMode(nvmlDevice_t device, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAccountingMode + _check_or_init_nvml() + if __nvmlDeviceGetAccountingMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAccountingMode is not found") + return (__nvmlDeviceGetAccountingMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceGetAccountingStats(nvmlDevice_t device, unsigned int pid, nvmlAccountingStats_t* stats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAccountingStats + _check_or_init_nvml() + if __nvmlDeviceGetAccountingStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAccountingStats is not found") + return (__nvmlDeviceGetAccountingStats)( + device, pid, stats) + + +cdef nvmlReturn_t _nvmlDeviceGetAccountingPids(nvmlDevice_t device, unsigned int* count, unsigned int* pids) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAccountingPids + _check_or_init_nvml() + if __nvmlDeviceGetAccountingPids == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAccountingPids is not found") + return (__nvmlDeviceGetAccountingPids)( + device, count, pids) + + +cdef nvmlReturn_t _nvmlDeviceGetAccountingBufferSize(nvmlDevice_t device, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAccountingBufferSize + _check_or_init_nvml() + if __nvmlDeviceGetAccountingBufferSize == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAccountingBufferSize is not found") + return (__nvmlDeviceGetAccountingBufferSize)( + device, bufferSize) + + +cdef nvmlReturn_t _nvmlDeviceGetRetiredPages(nvmlDevice_t device, nvmlPageRetirementCause_t cause, unsigned int* pageCount, unsigned long long* addresses) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRetiredPages + _check_or_init_nvml() + if __nvmlDeviceGetRetiredPages == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRetiredPages is not found") + return (__nvmlDeviceGetRetiredPages)( + device, cause, pageCount, addresses) + + +cdef nvmlReturn_t _nvmlDeviceGetRetiredPages_v2(nvmlDevice_t device, nvmlPageRetirementCause_t cause, unsigned int* pageCount, unsigned long long* addresses, unsigned long long* timestamps) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRetiredPages_v2 + _check_or_init_nvml() + if __nvmlDeviceGetRetiredPages_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRetiredPages_v2 is not found") + return (__nvmlDeviceGetRetiredPages_v2)( + device, cause, pageCount, addresses, timestamps) + + +cdef nvmlReturn_t _nvmlDeviceGetRetiredPagesPendingStatus(nvmlDevice_t device, nvmlEnableState_t* isPending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRetiredPagesPendingStatus + _check_or_init_nvml() + if __nvmlDeviceGetRetiredPagesPendingStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRetiredPagesPendingStatus is not found") + return (__nvmlDeviceGetRetiredPagesPendingStatus)( + device, isPending) + + +cdef nvmlReturn_t _nvmlDeviceGetRemappedRows(nvmlDevice_t device, unsigned int* corrRows, unsigned int* uncRows, unsigned int* isPending, unsigned int* failureOccurred) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRemappedRows + _check_or_init_nvml() + if __nvmlDeviceGetRemappedRows == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRemappedRows is not found") + return (__nvmlDeviceGetRemappedRows)( + device, corrRows, uncRows, isPending, failureOccurred) + + +cdef nvmlReturn_t _nvmlDeviceGetRowRemapperHistogram(nvmlDevice_t device, nvmlRowRemapperHistogramValues_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRowRemapperHistogram + _check_or_init_nvml() + if __nvmlDeviceGetRowRemapperHistogram == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRowRemapperHistogram is not found") + return (__nvmlDeviceGetRowRemapperHistogram)( + device, values) + + +cdef nvmlReturn_t _nvmlDeviceGetArchitecture(nvmlDevice_t device, nvmlDeviceArchitecture_t* arch) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetArchitecture + _check_or_init_nvml() + if __nvmlDeviceGetArchitecture == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetArchitecture is not found") + return (__nvmlDeviceGetArchitecture)( + device, arch) + + +cdef nvmlReturn_t _nvmlDeviceGetClkMonStatus(nvmlDevice_t device, nvmlClkMonStatus_t* status) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetClkMonStatus + _check_or_init_nvml() + if __nvmlDeviceGetClkMonStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetClkMonStatus is not found") + return (__nvmlDeviceGetClkMonStatus)( + device, status) + + +cdef nvmlReturn_t _nvmlDeviceGetProcessUtilization(nvmlDevice_t device, nvmlProcessUtilizationSample_t* utilization, unsigned int* processSamplesCount, unsigned long long lastSeenTimeStamp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetProcessUtilization + _check_or_init_nvml() + if __nvmlDeviceGetProcessUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetProcessUtilization is not found") + return (__nvmlDeviceGetProcessUtilization)( + device, utilization, processSamplesCount, lastSeenTimeStamp) + + +cdef nvmlReturn_t _nvmlDeviceGetProcessesUtilizationInfo(nvmlDevice_t device, nvmlProcessesUtilizationInfo_t* procesesUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetProcessesUtilizationInfo + _check_or_init_nvml() + if __nvmlDeviceGetProcessesUtilizationInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetProcessesUtilizationInfo is not found") + return (__nvmlDeviceGetProcessesUtilizationInfo)( + device, procesesUtilInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetPlatformInfo(nvmlDevice_t device, nvmlPlatformInfo_t* platformInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPlatformInfo + _check_or_init_nvml() + if __nvmlDeviceGetPlatformInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPlatformInfo is not found") + return (__nvmlDeviceGetPlatformInfo)( + device, platformInfo) + + +cdef nvmlReturn_t _nvmlUnitSetLedState(nvmlUnit_t unit, nvmlLedColor_t color) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitSetLedState + _check_or_init_nvml() + if __nvmlUnitSetLedState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitSetLedState is not found") + return (__nvmlUnitSetLedState)( + unit, color) + + +cdef nvmlReturn_t _nvmlDeviceSetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetPersistenceMode + _check_or_init_nvml() + if __nvmlDeviceSetPersistenceMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetPersistenceMode is not found") + return (__nvmlDeviceSetPersistenceMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceSetComputeMode(nvmlDevice_t device, nvmlComputeMode_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetComputeMode + _check_or_init_nvml() + if __nvmlDeviceSetComputeMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetComputeMode is not found") + return (__nvmlDeviceSetComputeMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceSetEccMode(nvmlDevice_t device, nvmlEnableState_t ecc) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetEccMode + _check_or_init_nvml() + if __nvmlDeviceSetEccMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetEccMode is not found") + return (__nvmlDeviceSetEccMode)( + device, ecc) + + +cdef nvmlReturn_t _nvmlDeviceClearEccErrorCounts(nvmlDevice_t device, nvmlEccCounterType_t counterType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceClearEccErrorCounts + _check_or_init_nvml() + if __nvmlDeviceClearEccErrorCounts == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceClearEccErrorCounts is not found") + return (__nvmlDeviceClearEccErrorCounts)( + device, counterType) + + +cdef nvmlReturn_t _nvmlDeviceSetDriverModel(nvmlDevice_t device, nvmlDriverModel_t driverModel, unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetDriverModel + _check_or_init_nvml() + if __nvmlDeviceSetDriverModel == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetDriverModel is not found") + return (__nvmlDeviceSetDriverModel)( + device, driverModel, flags) + + +cdef nvmlReturn_t _nvmlDeviceSetGpuLockedClocks(nvmlDevice_t device, unsigned int minGpuClockMHz, unsigned int maxGpuClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetGpuLockedClocks + _check_or_init_nvml() + if __nvmlDeviceSetGpuLockedClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetGpuLockedClocks is not found") + return (__nvmlDeviceSetGpuLockedClocks)( + device, minGpuClockMHz, maxGpuClockMHz) + + +cdef nvmlReturn_t _nvmlDeviceResetGpuLockedClocks(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceResetGpuLockedClocks + _check_or_init_nvml() + if __nvmlDeviceResetGpuLockedClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceResetGpuLockedClocks is not found") + return (__nvmlDeviceResetGpuLockedClocks)( + device) + + +cdef nvmlReturn_t _nvmlDeviceSetMemoryLockedClocks(nvmlDevice_t device, unsigned int minMemClockMHz, unsigned int maxMemClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetMemoryLockedClocks + _check_or_init_nvml() + if __nvmlDeviceSetMemoryLockedClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetMemoryLockedClocks is not found") + return (__nvmlDeviceSetMemoryLockedClocks)( + device, minMemClockMHz, maxMemClockMHz) + + +cdef nvmlReturn_t _nvmlDeviceResetMemoryLockedClocks(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceResetMemoryLockedClocks + _check_or_init_nvml() + if __nvmlDeviceResetMemoryLockedClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceResetMemoryLockedClocks is not found") + return (__nvmlDeviceResetMemoryLockedClocks)( + device) + + +cdef nvmlReturn_t _nvmlDeviceSetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetAutoBoostedClocksEnabled + _check_or_init_nvml() + if __nvmlDeviceSetAutoBoostedClocksEnabled == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetAutoBoostedClocksEnabled is not found") + return (__nvmlDeviceSetAutoBoostedClocksEnabled)( + device, enabled) + + +cdef nvmlReturn_t _nvmlDeviceSetDefaultAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled, unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetDefaultAutoBoostedClocksEnabled + _check_or_init_nvml() + if __nvmlDeviceSetDefaultAutoBoostedClocksEnabled == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetDefaultAutoBoostedClocksEnabled is not found") + return (__nvmlDeviceSetDefaultAutoBoostedClocksEnabled)( + device, enabled, flags) + + +cdef nvmlReturn_t _nvmlDeviceSetDefaultFanSpeed_v2(nvmlDevice_t device, unsigned int fan) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetDefaultFanSpeed_v2 + _check_or_init_nvml() + if __nvmlDeviceSetDefaultFanSpeed_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetDefaultFanSpeed_v2 is not found") + return (__nvmlDeviceSetDefaultFanSpeed_v2)( + device, fan) + + +cdef nvmlReturn_t _nvmlDeviceSetFanControlPolicy(nvmlDevice_t device, unsigned int fan, nvmlFanControlPolicy_t policy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetFanControlPolicy + _check_or_init_nvml() + if __nvmlDeviceSetFanControlPolicy == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetFanControlPolicy is not found") + return (__nvmlDeviceSetFanControlPolicy)( + device, fan, policy) + + +cdef nvmlReturn_t _nvmlDeviceSetTemperatureThreshold(nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetTemperatureThreshold + _check_or_init_nvml() + if __nvmlDeviceSetTemperatureThreshold == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetTemperatureThreshold is not found") + return (__nvmlDeviceSetTemperatureThreshold)( + device, thresholdType, temp) + + +cdef nvmlReturn_t _nvmlDeviceSetPowerManagementLimit(nvmlDevice_t device, unsigned int limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetPowerManagementLimit + _check_or_init_nvml() + if __nvmlDeviceSetPowerManagementLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetPowerManagementLimit is not found") + return (__nvmlDeviceSetPowerManagementLimit)( + device, limit) + + +cdef nvmlReturn_t _nvmlDeviceSetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetGpuOperationMode + _check_or_init_nvml() + if __nvmlDeviceSetGpuOperationMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetGpuOperationMode is not found") + return (__nvmlDeviceSetGpuOperationMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceSetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t isRestricted) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetAPIRestriction + _check_or_init_nvml() + if __nvmlDeviceSetAPIRestriction == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetAPIRestriction is not found") + return (__nvmlDeviceSetAPIRestriction)( + device, apiType, isRestricted) + + +cdef nvmlReturn_t _nvmlDeviceSetFanSpeed_v2(nvmlDevice_t device, unsigned int fan, unsigned int speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetFanSpeed_v2 + _check_or_init_nvml() + if __nvmlDeviceSetFanSpeed_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetFanSpeed_v2 is not found") + return (__nvmlDeviceSetFanSpeed_v2)( + device, fan, speed) + + +cdef nvmlReturn_t _nvmlDeviceSetAccountingMode(nvmlDevice_t device, nvmlEnableState_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetAccountingMode + _check_or_init_nvml() + if __nvmlDeviceSetAccountingMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetAccountingMode is not found") + return (__nvmlDeviceSetAccountingMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceClearAccountingPids(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceClearAccountingPids + _check_or_init_nvml() + if __nvmlDeviceClearAccountingPids == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceClearAccountingPids is not found") + return (__nvmlDeviceClearAccountingPids)( + device) + + +cdef nvmlReturn_t _nvmlDeviceSetPowerManagementLimit_v2(nvmlDevice_t device, nvmlPowerValue_v2_t* powerValue) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetPowerManagementLimit_v2 + _check_or_init_nvml() + if __nvmlDeviceSetPowerManagementLimit_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetPowerManagementLimit_v2 is not found") + return (__nvmlDeviceSetPowerManagementLimit_v2)( + device, powerValue) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkState(nvmlDevice_t device, unsigned int link, nvmlEnableState_t* isActive) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkState + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkState is not found") + return (__nvmlDeviceGetNvLinkState)( + device, link, isActive) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkVersion(nvmlDevice_t device, unsigned int link, unsigned int* version) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkVersion + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkVersion is not found") + return (__nvmlDeviceGetNvLinkVersion)( + device, link, version) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkCapability(nvmlDevice_t device, unsigned int link, nvmlNvLinkCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkCapability + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkCapability == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkCapability is not found") + return (__nvmlDeviceGetNvLinkCapability)( + device, link, capability, capResult) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkRemotePciInfo_v2(nvmlDevice_t device, unsigned int link, nvmlPciInfo_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkRemotePciInfo_v2 + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkRemotePciInfo_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkRemotePciInfo_v2 is not found") + return (__nvmlDeviceGetNvLinkRemotePciInfo_v2)( + device, link, pci) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkErrorCounter(nvmlDevice_t device, unsigned int link, nvmlNvLinkErrorCounter_t counter, unsigned long long* counterValue) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkErrorCounter + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkErrorCounter == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkErrorCounter is not found") + return (__nvmlDeviceGetNvLinkErrorCounter)( + device, link, counter, counterValue) + + +cdef nvmlReturn_t _nvmlDeviceResetNvLinkErrorCounters(nvmlDevice_t device, unsigned int link) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceResetNvLinkErrorCounters + _check_or_init_nvml() + if __nvmlDeviceResetNvLinkErrorCounters == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceResetNvLinkErrorCounters is not found") + return (__nvmlDeviceResetNvLinkErrorCounters)( + device, link) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkRemoteDeviceType(nvmlDevice_t device, unsigned int link, nvmlIntNvLinkDeviceType_t* pNvLinkDeviceType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkRemoteDeviceType + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkRemoteDeviceType == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkRemoteDeviceType is not found") + return (__nvmlDeviceGetNvLinkRemoteDeviceType)( + device, link, pNvLinkDeviceType) + + +cdef nvmlReturn_t _nvmlDeviceSetNvLinkDeviceLowPowerThreshold(nvmlDevice_t device, nvmlNvLinkPowerThres_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetNvLinkDeviceLowPowerThreshold + _check_or_init_nvml() + if __nvmlDeviceSetNvLinkDeviceLowPowerThreshold == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetNvLinkDeviceLowPowerThreshold is not found") + return (__nvmlDeviceSetNvLinkDeviceLowPowerThreshold)( + device, info) + + +cdef nvmlReturn_t _nvmlSystemSetNvlinkBwMode(unsigned int nvlinkBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemSetNvlinkBwMode + _check_or_init_nvml() + if __nvmlSystemSetNvlinkBwMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemSetNvlinkBwMode is not found") + return (__nvmlSystemSetNvlinkBwMode)( + nvlinkBwMode) + + +cdef nvmlReturn_t _nvmlSystemGetNvlinkBwMode(unsigned int* nvlinkBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetNvlinkBwMode + _check_or_init_nvml() + if __nvmlSystemGetNvlinkBwMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetNvlinkBwMode is not found") + return (__nvmlSystemGetNvlinkBwMode)( + nvlinkBwMode) + + +cdef nvmlReturn_t _nvmlDeviceGetNvlinkSupportedBwModes(nvmlDevice_t device, nvmlNvlinkSupportedBwModes_t* supportedBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvlinkSupportedBwModes + _check_or_init_nvml() + if __nvmlDeviceGetNvlinkSupportedBwModes == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvlinkSupportedBwModes is not found") + return (__nvmlDeviceGetNvlinkSupportedBwModes)( + device, supportedBwMode) + + +cdef nvmlReturn_t _nvmlDeviceGetNvlinkBwMode(nvmlDevice_t device, nvmlNvlinkGetBwMode_t* getBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvlinkBwMode + _check_or_init_nvml() + if __nvmlDeviceGetNvlinkBwMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvlinkBwMode is not found") + return (__nvmlDeviceGetNvlinkBwMode)( + device, getBwMode) + + +cdef nvmlReturn_t _nvmlDeviceSetNvlinkBwMode(nvmlDevice_t device, nvmlNvlinkSetBwMode_t* setBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetNvlinkBwMode + _check_or_init_nvml() + if __nvmlDeviceSetNvlinkBwMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetNvlinkBwMode is not found") + return (__nvmlDeviceSetNvlinkBwMode)( + device, setBwMode) + + +cdef nvmlReturn_t _nvmlEventSetCreate(nvmlEventSet_t* set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlEventSetCreate + _check_or_init_nvml() + if __nvmlEventSetCreate == NULL: + with gil: + raise FunctionNotFoundError("function nvmlEventSetCreate is not found") + return (__nvmlEventSetCreate)( + set) + + +cdef nvmlReturn_t _nvmlDeviceRegisterEvents(nvmlDevice_t device, unsigned long long eventTypes, nvmlEventSet_t set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceRegisterEvents + _check_or_init_nvml() + if __nvmlDeviceRegisterEvents == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceRegisterEvents is not found") + return (__nvmlDeviceRegisterEvents)( + device, eventTypes, set) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedEventTypes(nvmlDevice_t device, unsigned long long* eventTypes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedEventTypes + _check_or_init_nvml() + if __nvmlDeviceGetSupportedEventTypes == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedEventTypes is not found") + return (__nvmlDeviceGetSupportedEventTypes)( + device, eventTypes) + + +cdef nvmlReturn_t _nvmlEventSetWait_v2(nvmlEventSet_t set, nvmlEventData_t* data, unsigned int timeoutms) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlEventSetWait_v2 + _check_or_init_nvml() + if __nvmlEventSetWait_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlEventSetWait_v2 is not found") + return (__nvmlEventSetWait_v2)( + set, data, timeoutms) + + +cdef nvmlReturn_t _nvmlEventSetFree(nvmlEventSet_t set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlEventSetFree + _check_or_init_nvml() + if __nvmlEventSetFree == NULL: + with gil: + raise FunctionNotFoundError("function nvmlEventSetFree is not found") + return (__nvmlEventSetFree)( + set) + + +cdef nvmlReturn_t _nvmlSystemEventSetCreate(nvmlSystemEventSetCreateRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemEventSetCreate + _check_or_init_nvml() + if __nvmlSystemEventSetCreate == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemEventSetCreate is not found") + return (__nvmlSystemEventSetCreate)( + request) + + +cdef nvmlReturn_t _nvmlSystemEventSetFree(nvmlSystemEventSetFreeRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemEventSetFree + _check_or_init_nvml() + if __nvmlSystemEventSetFree == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemEventSetFree is not found") + return (__nvmlSystemEventSetFree)( + request) + + +cdef nvmlReturn_t _nvmlSystemRegisterEvents(nvmlSystemRegisterEventRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemRegisterEvents + _check_or_init_nvml() + if __nvmlSystemRegisterEvents == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemRegisterEvents is not found") + return (__nvmlSystemRegisterEvents)( + request) + + +cdef nvmlReturn_t _nvmlSystemEventSetWait(nvmlSystemEventSetWaitRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemEventSetWait + _check_or_init_nvml() + if __nvmlSystemEventSetWait == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemEventSetWait is not found") + return (__nvmlSystemEventSetWait)( + request) + + +cdef nvmlReturn_t _nvmlDeviceModifyDrainState(nvmlPciInfo_t* pciInfo, nvmlEnableState_t newState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceModifyDrainState + _check_or_init_nvml() + if __nvmlDeviceModifyDrainState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceModifyDrainState is not found") + return (__nvmlDeviceModifyDrainState)( + pciInfo, newState) + + +cdef nvmlReturn_t _nvmlDeviceQueryDrainState(nvmlPciInfo_t* pciInfo, nvmlEnableState_t* currentState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceQueryDrainState + _check_or_init_nvml() + if __nvmlDeviceQueryDrainState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceQueryDrainState is not found") + return (__nvmlDeviceQueryDrainState)( + pciInfo, currentState) + + +cdef nvmlReturn_t _nvmlDeviceRemoveGpu_v2(nvmlPciInfo_t* pciInfo, nvmlDetachGpuState_t gpuState, nvmlPcieLinkState_t linkState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceRemoveGpu_v2 + _check_or_init_nvml() + if __nvmlDeviceRemoveGpu_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceRemoveGpu_v2 is not found") + return (__nvmlDeviceRemoveGpu_v2)( + pciInfo, gpuState, linkState) + + +cdef nvmlReturn_t _nvmlDeviceDiscoverGpus(nvmlPciInfo_t* pciInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceDiscoverGpus + _check_or_init_nvml() + if __nvmlDeviceDiscoverGpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceDiscoverGpus is not found") + return (__nvmlDeviceDiscoverGpus)( + pciInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetFieldValues(nvmlDevice_t device, int valuesCount, nvmlFieldValue_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFieldValues + _check_or_init_nvml() + if __nvmlDeviceGetFieldValues == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFieldValues is not found") + return (__nvmlDeviceGetFieldValues)( + device, valuesCount, values) + + +cdef nvmlReturn_t _nvmlDeviceClearFieldValues(nvmlDevice_t device, int valuesCount, nvmlFieldValue_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceClearFieldValues + _check_or_init_nvml() + if __nvmlDeviceClearFieldValues == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceClearFieldValues is not found") + return (__nvmlDeviceClearFieldValues)( + device, valuesCount, values) + + +cdef nvmlReturn_t _nvmlDeviceGetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t* pVirtualMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVirtualizationMode + _check_or_init_nvml() + if __nvmlDeviceGetVirtualizationMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVirtualizationMode is not found") + return (__nvmlDeviceGetVirtualizationMode)( + device, pVirtualMode) + + +cdef nvmlReturn_t _nvmlDeviceGetHostVgpuMode(nvmlDevice_t device, nvmlHostVgpuMode_t* pHostVgpuMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHostVgpuMode + _check_or_init_nvml() + if __nvmlDeviceGetHostVgpuMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHostVgpuMode is not found") + return (__nvmlDeviceGetHostVgpuMode)( + device, pHostVgpuMode) + + +cdef nvmlReturn_t _nvmlDeviceSetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t virtualMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetVirtualizationMode + _check_or_init_nvml() + if __nvmlDeviceSetVirtualizationMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetVirtualizationMode is not found") + return (__nvmlDeviceSetVirtualizationMode)( + device, virtualMode) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuHeterogeneousMode(nvmlDevice_t device, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuHeterogeneousMode + _check_or_init_nvml() + if __nvmlDeviceGetVgpuHeterogeneousMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuHeterogeneousMode is not found") + return (__nvmlDeviceGetVgpuHeterogeneousMode)( + device, pHeterogeneousMode) + + +cdef nvmlReturn_t _nvmlDeviceSetVgpuHeterogeneousMode(nvmlDevice_t device, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetVgpuHeterogeneousMode + _check_or_init_nvml() + if __nvmlDeviceSetVgpuHeterogeneousMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetVgpuHeterogeneousMode is not found") + return (__nvmlDeviceSetVgpuHeterogeneousMode)( + device, pHeterogeneousMode) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetPlacementId(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuPlacementId_t* pPlacement) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetPlacementId + _check_or_init_nvml() + if __nvmlVgpuInstanceGetPlacementId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetPlacementId is not found") + return (__nvmlVgpuInstanceGetPlacementId)( + vgpuInstance, pPlacement) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuTypeSupportedPlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuTypeSupportedPlacements + _check_or_init_nvml() + if __nvmlDeviceGetVgpuTypeSupportedPlacements == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuTypeSupportedPlacements is not found") + return (__nvmlDeviceGetVgpuTypeSupportedPlacements)( + device, vgpuTypeId, pPlacementList) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuTypeCreatablePlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuTypeCreatablePlacements + _check_or_init_nvml() + if __nvmlDeviceGetVgpuTypeCreatablePlacements == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuTypeCreatablePlacements is not found") + return (__nvmlDeviceGetVgpuTypeCreatablePlacements)( + device, vgpuTypeId, pPlacementList) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetGspHeapSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* gspHeapSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetGspHeapSize + _check_or_init_nvml() + if __nvmlVgpuTypeGetGspHeapSize == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetGspHeapSize is not found") + return (__nvmlVgpuTypeGetGspHeapSize)( + vgpuTypeId, gspHeapSize) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetFbReservation(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbReservation) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetFbReservation + _check_or_init_nvml() + if __nvmlVgpuTypeGetFbReservation == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetFbReservation is not found") + return (__nvmlVgpuTypeGetFbReservation)( + vgpuTypeId, fbReservation) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetRuntimeStateSize(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuRuntimeState_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetRuntimeStateSize + _check_or_init_nvml() + if __nvmlVgpuInstanceGetRuntimeStateSize == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetRuntimeStateSize is not found") + return (__nvmlVgpuInstanceGetRuntimeStateSize)( + vgpuInstance, pState) + + +cdef nvmlReturn_t _nvmlDeviceSetVgpuCapabilities(nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, nvmlEnableState_t state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetVgpuCapabilities + _check_or_init_nvml() + if __nvmlDeviceSetVgpuCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetVgpuCapabilities is not found") + return (__nvmlDeviceSetVgpuCapabilities)( + device, capability, state) + + +cdef nvmlReturn_t _nvmlDeviceGetGridLicensableFeatures_v4(nvmlDevice_t device, nvmlGridLicensableFeatures_t* pGridLicensableFeatures) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGridLicensableFeatures_v4 + _check_or_init_nvml() + if __nvmlDeviceGetGridLicensableFeatures_v4 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGridLicensableFeatures_v4 is not found") + return (__nvmlDeviceGetGridLicensableFeatures_v4)( + device, pGridLicensableFeatures) + + +cdef nvmlReturn_t _nvmlGetVgpuDriverCapabilities(nvmlVgpuDriverCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGetVgpuDriverCapabilities + _check_or_init_nvml() + if __nvmlGetVgpuDriverCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGetVgpuDriverCapabilities is not found") + return (__nvmlGetVgpuDriverCapabilities)( + capability, capResult) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuCapabilities(nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuCapabilities + _check_or_init_nvml() + if __nvmlDeviceGetVgpuCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuCapabilities is not found") + return (__nvmlDeviceGetVgpuCapabilities)( + device, capability, capResult) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuTypeId_t* vgpuTypeIds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedVgpus + _check_or_init_nvml() + if __nvmlDeviceGetSupportedVgpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedVgpus is not found") + return (__nvmlDeviceGetSupportedVgpus)( + device, vgpuCount, vgpuTypeIds) + + +cdef nvmlReturn_t _nvmlDeviceGetCreatableVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuTypeId_t* vgpuTypeIds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCreatableVgpus + _check_or_init_nvml() + if __nvmlDeviceGetCreatableVgpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCreatableVgpus is not found") + return (__nvmlDeviceGetCreatableVgpus)( + device, vgpuCount, vgpuTypeIds) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetClass(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeClass, unsigned int* size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetClass + _check_or_init_nvml() + if __nvmlVgpuTypeGetClass == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetClass is not found") + return (__nvmlVgpuTypeGetClass)( + vgpuTypeId, vgpuTypeClass, size) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetName(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeName, unsigned int* size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetName + _check_or_init_nvml() + if __nvmlVgpuTypeGetName == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetName is not found") + return (__nvmlVgpuTypeGetName)( + vgpuTypeId, vgpuTypeName, size) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetGpuInstanceProfileId(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* gpuInstanceProfileId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetGpuInstanceProfileId + _check_or_init_nvml() + if __nvmlVgpuTypeGetGpuInstanceProfileId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetGpuInstanceProfileId is not found") + return (__nvmlVgpuTypeGetGpuInstanceProfileId)( + vgpuTypeId, gpuInstanceProfileId) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetDeviceID(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* deviceID, unsigned long long* subsystemID) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetDeviceID + _check_or_init_nvml() + if __nvmlVgpuTypeGetDeviceID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetDeviceID is not found") + return (__nvmlVgpuTypeGetDeviceID)( + vgpuTypeId, deviceID, subsystemID) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetFramebufferSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetFramebufferSize + _check_or_init_nvml() + if __nvmlVgpuTypeGetFramebufferSize == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetFramebufferSize is not found") + return (__nvmlVgpuTypeGetFramebufferSize)( + vgpuTypeId, fbSize) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetNumDisplayHeads(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* numDisplayHeads) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetNumDisplayHeads + _check_or_init_nvml() + if __nvmlVgpuTypeGetNumDisplayHeads == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetNumDisplayHeads is not found") + return (__nvmlVgpuTypeGetNumDisplayHeads)( + vgpuTypeId, numDisplayHeads) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetResolution(nvmlVgpuTypeId_t vgpuTypeId, unsigned int displayIndex, unsigned int* xdim, unsigned int* ydim) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetResolution + _check_or_init_nvml() + if __nvmlVgpuTypeGetResolution == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetResolution is not found") + return (__nvmlVgpuTypeGetResolution)( + vgpuTypeId, displayIndex, xdim, ydim) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetLicense(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeLicenseString, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetLicense + _check_or_init_nvml() + if __nvmlVgpuTypeGetLicense == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetLicense is not found") + return (__nvmlVgpuTypeGetLicense)( + vgpuTypeId, vgpuTypeLicenseString, size) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetFrameRateLimit(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* frameRateLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetFrameRateLimit + _check_or_init_nvml() + if __nvmlVgpuTypeGetFrameRateLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetFrameRateLimit is not found") + return (__nvmlVgpuTypeGetFrameRateLimit)( + vgpuTypeId, frameRateLimit) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetMaxInstances(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, unsigned int* vgpuInstanceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetMaxInstances + _check_or_init_nvml() + if __nvmlVgpuTypeGetMaxInstances == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetMaxInstances is not found") + return (__nvmlVgpuTypeGetMaxInstances)( + device, vgpuTypeId, vgpuInstanceCount) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetMaxInstancesPerVm(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* vgpuInstanceCountPerVm) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetMaxInstancesPerVm + _check_or_init_nvml() + if __nvmlVgpuTypeGetMaxInstancesPerVm == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetMaxInstancesPerVm is not found") + return (__nvmlVgpuTypeGetMaxInstancesPerVm)( + vgpuTypeId, vgpuInstanceCountPerVm) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetBAR1Info(nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuTypeBar1Info_t* bar1Info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetBAR1Info + _check_or_init_nvml() + if __nvmlVgpuTypeGetBAR1Info == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetBAR1Info is not found") + return (__nvmlVgpuTypeGetBAR1Info)( + vgpuTypeId, bar1Info) + + +cdef nvmlReturn_t _nvmlDeviceGetActiveVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuInstance_t* vgpuInstances) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetActiveVgpus + _check_or_init_nvml() + if __nvmlDeviceGetActiveVgpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetActiveVgpus is not found") + return (__nvmlDeviceGetActiveVgpus)( + device, vgpuCount, vgpuInstances) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetVmID(nvmlVgpuInstance_t vgpuInstance, char* vmId, unsigned int size, nvmlVgpuVmIdType_t* vmIdType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetVmID + _check_or_init_nvml() + if __nvmlVgpuInstanceGetVmID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetVmID is not found") + return (__nvmlVgpuInstanceGetVmID)( + vgpuInstance, vmId, size, vmIdType) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetUUID(nvmlVgpuInstance_t vgpuInstance, char* uuid, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetUUID + _check_or_init_nvml() + if __nvmlVgpuInstanceGetUUID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetUUID is not found") + return (__nvmlVgpuInstanceGetUUID)( + vgpuInstance, uuid, size) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetVmDriverVersion(nvmlVgpuInstance_t vgpuInstance, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetVmDriverVersion + _check_or_init_nvml() + if __nvmlVgpuInstanceGetVmDriverVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetVmDriverVersion is not found") + return (__nvmlVgpuInstanceGetVmDriverVersion)( + vgpuInstance, version, length) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetFbUsage(nvmlVgpuInstance_t vgpuInstance, unsigned long long* fbUsage) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetFbUsage + _check_or_init_nvml() + if __nvmlVgpuInstanceGetFbUsage == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetFbUsage is not found") + return (__nvmlVgpuInstanceGetFbUsage)( + vgpuInstance, fbUsage) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetLicenseStatus(nvmlVgpuInstance_t vgpuInstance, unsigned int* licensed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetLicenseStatus + _check_or_init_nvml() + if __nvmlVgpuInstanceGetLicenseStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetLicenseStatus is not found") + return (__nvmlVgpuInstanceGetLicenseStatus)( + vgpuInstance, licensed) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetType(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuTypeId_t* vgpuTypeId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetType + _check_or_init_nvml() + if __nvmlVgpuInstanceGetType == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetType is not found") + return (__nvmlVgpuInstanceGetType)( + vgpuInstance, vgpuTypeId) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetFrameRateLimit(nvmlVgpuInstance_t vgpuInstance, unsigned int* frameRateLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetFrameRateLimit + _check_or_init_nvml() + if __nvmlVgpuInstanceGetFrameRateLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetFrameRateLimit is not found") + return (__nvmlVgpuInstanceGetFrameRateLimit)( + vgpuInstance, frameRateLimit) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetEccMode(nvmlVgpuInstance_t vgpuInstance, nvmlEnableState_t* eccMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetEccMode + _check_or_init_nvml() + if __nvmlVgpuInstanceGetEccMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetEccMode is not found") + return (__nvmlVgpuInstanceGetEccMode)( + vgpuInstance, eccMode) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int* encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetEncoderCapacity + _check_or_init_nvml() + if __nvmlVgpuInstanceGetEncoderCapacity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetEncoderCapacity is not found") + return (__nvmlVgpuInstanceGetEncoderCapacity)( + vgpuInstance, encoderCapacity) + + +cdef nvmlReturn_t _nvmlVgpuInstanceSetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceSetEncoderCapacity + _check_or_init_nvml() + if __nvmlVgpuInstanceSetEncoderCapacity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceSetEncoderCapacity is not found") + return (__nvmlVgpuInstanceSetEncoderCapacity)( + vgpuInstance, encoderCapacity) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetEncoderStats(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, unsigned int* averageFps, unsigned int* averageLatency) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetEncoderStats + _check_or_init_nvml() + if __nvmlVgpuInstanceGetEncoderStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetEncoderStats is not found") + return (__nvmlVgpuInstanceGetEncoderStats)( + vgpuInstance, sessionCount, averageFps, averageLatency) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetEncoderSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, nvmlEncoderSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetEncoderSessions + _check_or_init_nvml() + if __nvmlVgpuInstanceGetEncoderSessions == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetEncoderSessions is not found") + return (__nvmlVgpuInstanceGetEncoderSessions)( + vgpuInstance, sessionCount, sessionInfo) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetFBCStats(nvmlVgpuInstance_t vgpuInstance, nvmlFBCStats_t* fbcStats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetFBCStats + _check_or_init_nvml() + if __nvmlVgpuInstanceGetFBCStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetFBCStats is not found") + return (__nvmlVgpuInstanceGetFBCStats)( + vgpuInstance, fbcStats) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetFBCSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, nvmlFBCSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetFBCSessions + _check_or_init_nvml() + if __nvmlVgpuInstanceGetFBCSessions == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetFBCSessions is not found") + return (__nvmlVgpuInstanceGetFBCSessions)( + vgpuInstance, sessionCount, sessionInfo) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetGpuInstanceId(nvmlVgpuInstance_t vgpuInstance, unsigned int* gpuInstanceId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetGpuInstanceId + _check_or_init_nvml() + if __nvmlVgpuInstanceGetGpuInstanceId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetGpuInstanceId is not found") + return (__nvmlVgpuInstanceGetGpuInstanceId)( + vgpuInstance, gpuInstanceId) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetGpuPciId(nvmlVgpuInstance_t vgpuInstance, char* vgpuPciId, unsigned int* length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetGpuPciId + _check_or_init_nvml() + if __nvmlVgpuInstanceGetGpuPciId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetGpuPciId is not found") + return (__nvmlVgpuInstanceGetGpuPciId)( + vgpuInstance, vgpuPciId, length) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetCapabilities(nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetCapabilities + _check_or_init_nvml() + if __nvmlVgpuTypeGetCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetCapabilities is not found") + return (__nvmlVgpuTypeGetCapabilities)( + vgpuTypeId, capability, capResult) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetMdevUUID(nvmlVgpuInstance_t vgpuInstance, char* mdevUuid, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetMdevUUID + _check_or_init_nvml() + if __nvmlVgpuInstanceGetMdevUUID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetMdevUUID is not found") + return (__nvmlVgpuInstanceGetMdevUUID)( + vgpuInstance, mdevUuid, size) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetCreatableVgpus(nvmlGpuInstance_t gpuInstance, nvmlVgpuTypeIdInfo_t* pVgpus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetCreatableVgpus + _check_or_init_nvml() + if __nvmlGpuInstanceGetCreatableVgpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetCreatableVgpus is not found") + return (__nvmlGpuInstanceGetCreatableVgpus)( + gpuInstance, pVgpus) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetMaxInstancesPerGpuInstance(nvmlVgpuTypeMaxInstance_t* pMaxInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetMaxInstancesPerGpuInstance + _check_or_init_nvml() + if __nvmlVgpuTypeGetMaxInstancesPerGpuInstance == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetMaxInstancesPerGpuInstance is not found") + return (__nvmlVgpuTypeGetMaxInstancesPerGpuInstance)( + pMaxInstance) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetActiveVgpus(nvmlGpuInstance_t gpuInstance, nvmlActiveVgpuInstanceInfo_t* pVgpuInstanceInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetActiveVgpus + _check_or_init_nvml() + if __nvmlGpuInstanceGetActiveVgpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetActiveVgpus is not found") + return (__nvmlGpuInstanceGetActiveVgpus)( + gpuInstance, pVgpuInstanceInfo) + + +cdef nvmlReturn_t _nvmlGpuInstanceSetVgpuSchedulerState(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerState_t* pScheduler) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceSetVgpuSchedulerState + _check_or_init_nvml() + if __nvmlGpuInstanceSetVgpuSchedulerState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceSetVgpuSchedulerState is not found") + return (__nvmlGpuInstanceSetVgpuSchedulerState)( + gpuInstance, pScheduler) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuSchedulerState(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerStateInfo_t* pSchedulerStateInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetVgpuSchedulerState + _check_or_init_nvml() + if __nvmlGpuInstanceGetVgpuSchedulerState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetVgpuSchedulerState is not found") + return (__nvmlGpuInstanceGetVgpuSchedulerState)( + gpuInstance, pSchedulerStateInfo) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuSchedulerLog(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerLogInfo_t* pSchedulerLogInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetVgpuSchedulerLog + _check_or_init_nvml() + if __nvmlGpuInstanceGetVgpuSchedulerLog == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetVgpuSchedulerLog is not found") + return (__nvmlGpuInstanceGetVgpuSchedulerLog)( + gpuInstance, pSchedulerLogInfo) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuTypeCreatablePlacements(nvmlGpuInstance_t gpuInstance, nvmlVgpuCreatablePlacementInfo_t* pCreatablePlacementInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetVgpuTypeCreatablePlacements + _check_or_init_nvml() + if __nvmlGpuInstanceGetVgpuTypeCreatablePlacements == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetVgpuTypeCreatablePlacements is not found") + return (__nvmlGpuInstanceGetVgpuTypeCreatablePlacements)( + gpuInstance, pCreatablePlacementInfo) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuHeterogeneousMode(nvmlGpuInstance_t gpuInstance, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetVgpuHeterogeneousMode + _check_or_init_nvml() + if __nvmlGpuInstanceGetVgpuHeterogeneousMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetVgpuHeterogeneousMode is not found") + return (__nvmlGpuInstanceGetVgpuHeterogeneousMode)( + gpuInstance, pHeterogeneousMode) + + +cdef nvmlReturn_t _nvmlGpuInstanceSetVgpuHeterogeneousMode(nvmlGpuInstance_t gpuInstance, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceSetVgpuHeterogeneousMode + _check_or_init_nvml() + if __nvmlGpuInstanceSetVgpuHeterogeneousMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceSetVgpuHeterogeneousMode is not found") + return (__nvmlGpuInstanceSetVgpuHeterogeneousMode)( + gpuInstance, pHeterogeneousMode) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetMetadata(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuMetadata_t* vgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetMetadata + _check_or_init_nvml() + if __nvmlVgpuInstanceGetMetadata == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetMetadata is not found") + return (__nvmlVgpuInstanceGetMetadata)( + vgpuInstance, vgpuMetadata, bufferSize) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuMetadata(nvmlDevice_t device, nvmlVgpuPgpuMetadata_t* pgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuMetadata + _check_or_init_nvml() + if __nvmlDeviceGetVgpuMetadata == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuMetadata is not found") + return (__nvmlDeviceGetVgpuMetadata)( + device, pgpuMetadata, bufferSize) + + +cdef nvmlReturn_t _nvmlGetVgpuCompatibility(nvmlVgpuMetadata_t* vgpuMetadata, nvmlVgpuPgpuMetadata_t* pgpuMetadata, nvmlVgpuPgpuCompatibility_t* compatibilityInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGetVgpuCompatibility + _check_or_init_nvml() + if __nvmlGetVgpuCompatibility == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGetVgpuCompatibility is not found") + return (__nvmlGetVgpuCompatibility)( + vgpuMetadata, pgpuMetadata, compatibilityInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetPgpuMetadataString(nvmlDevice_t device, char* pgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPgpuMetadataString + _check_or_init_nvml() + if __nvmlDeviceGetPgpuMetadataString == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPgpuMetadataString is not found") + return (__nvmlDeviceGetPgpuMetadataString)( + device, pgpuMetadata, bufferSize) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerLog(nvmlDevice_t device, nvmlVgpuSchedulerLog_t* pSchedulerLog) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuSchedulerLog + _check_or_init_nvml() + if __nvmlDeviceGetVgpuSchedulerLog == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuSchedulerLog is not found") + return (__nvmlDeviceGetVgpuSchedulerLog)( + device, pSchedulerLog) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerState(nvmlDevice_t device, nvmlVgpuSchedulerGetState_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuSchedulerState + _check_or_init_nvml() + if __nvmlDeviceGetVgpuSchedulerState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuSchedulerState is not found") + return (__nvmlDeviceGetVgpuSchedulerState)( + device, pSchedulerState) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerCapabilities(nvmlDevice_t device, nvmlVgpuSchedulerCapabilities_t* pCapabilities) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuSchedulerCapabilities + _check_or_init_nvml() + if __nvmlDeviceGetVgpuSchedulerCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuSchedulerCapabilities is not found") + return (__nvmlDeviceGetVgpuSchedulerCapabilities)( + device, pCapabilities) + + +cdef nvmlReturn_t _nvmlDeviceSetVgpuSchedulerState(nvmlDevice_t device, nvmlVgpuSchedulerSetState_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetVgpuSchedulerState + _check_or_init_nvml() + if __nvmlDeviceSetVgpuSchedulerState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetVgpuSchedulerState is not found") + return (__nvmlDeviceSetVgpuSchedulerState)( + device, pSchedulerState) + + +cdef nvmlReturn_t _nvmlGetVgpuVersion(nvmlVgpuVersion_t* supported, nvmlVgpuVersion_t* current) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGetVgpuVersion + _check_or_init_nvml() + if __nvmlGetVgpuVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGetVgpuVersion is not found") + return (__nvmlGetVgpuVersion)( + supported, current) + + +cdef nvmlReturn_t _nvmlSetVgpuVersion(nvmlVgpuVersion_t* vgpuVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSetVgpuVersion + _check_or_init_nvml() + if __nvmlSetVgpuVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSetVgpuVersion is not found") + return (__nvmlSetVgpuVersion)( + vgpuVersion) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, nvmlValueType_t* sampleValType, unsigned int* vgpuInstanceSamplesCount, nvmlVgpuInstanceUtilizationSample_t* utilizationSamples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuUtilization + _check_or_init_nvml() + if __nvmlDeviceGetVgpuUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuUtilization is not found") + return (__nvmlDeviceGetVgpuUtilization)( + device, lastSeenTimeStamp, sampleValType, vgpuInstanceSamplesCount, utilizationSamples) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuInstancesUtilizationInfo(nvmlDevice_t device, nvmlVgpuInstancesUtilizationInfo_t* vgpuUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuInstancesUtilizationInfo + _check_or_init_nvml() + if __nvmlDeviceGetVgpuInstancesUtilizationInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuInstancesUtilizationInfo is not found") + return (__nvmlDeviceGetVgpuInstancesUtilizationInfo)( + device, vgpuUtilInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuProcessUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, unsigned int* vgpuProcessSamplesCount, nvmlVgpuProcessUtilizationSample_t* utilizationSamples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuProcessUtilization + _check_or_init_nvml() + if __nvmlDeviceGetVgpuProcessUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuProcessUtilization is not found") + return (__nvmlDeviceGetVgpuProcessUtilization)( + device, lastSeenTimeStamp, vgpuProcessSamplesCount, utilizationSamples) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuProcessesUtilizationInfo(nvmlDevice_t device, nvmlVgpuProcessesUtilizationInfo_t* vgpuProcUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuProcessesUtilizationInfo + _check_or_init_nvml() + if __nvmlDeviceGetVgpuProcessesUtilizationInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuProcessesUtilizationInfo is not found") + return (__nvmlDeviceGetVgpuProcessesUtilizationInfo)( + device, vgpuProcUtilInfo) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetAccountingMode(nvmlVgpuInstance_t vgpuInstance, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetAccountingMode + _check_or_init_nvml() + if __nvmlVgpuInstanceGetAccountingMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetAccountingMode is not found") + return (__nvmlVgpuInstanceGetAccountingMode)( + vgpuInstance, mode) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetAccountingPids(nvmlVgpuInstance_t vgpuInstance, unsigned int* count, unsigned int* pids) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetAccountingPids + _check_or_init_nvml() + if __nvmlVgpuInstanceGetAccountingPids == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetAccountingPids is not found") + return (__nvmlVgpuInstanceGetAccountingPids)( + vgpuInstance, count, pids) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetAccountingStats(nvmlVgpuInstance_t vgpuInstance, unsigned int pid, nvmlAccountingStats_t* stats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetAccountingStats + _check_or_init_nvml() + if __nvmlVgpuInstanceGetAccountingStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetAccountingStats is not found") + return (__nvmlVgpuInstanceGetAccountingStats)( + vgpuInstance, pid, stats) + + +cdef nvmlReturn_t _nvmlVgpuInstanceClearAccountingPids(nvmlVgpuInstance_t vgpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceClearAccountingPids + _check_or_init_nvml() + if __nvmlVgpuInstanceClearAccountingPids == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceClearAccountingPids is not found") + return (__nvmlVgpuInstanceClearAccountingPids)( + vgpuInstance) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetLicenseInfo_v2(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuLicenseInfo_t* licenseInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetLicenseInfo_v2 + _check_or_init_nvml() + if __nvmlVgpuInstanceGetLicenseInfo_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetLicenseInfo_v2 is not found") + return (__nvmlVgpuInstanceGetLicenseInfo_v2)( + vgpuInstance, licenseInfo) + + +cdef nvmlReturn_t _nvmlGetExcludedDeviceCount(unsigned int* deviceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGetExcludedDeviceCount + _check_or_init_nvml() + if __nvmlGetExcludedDeviceCount == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGetExcludedDeviceCount is not found") + return (__nvmlGetExcludedDeviceCount)( + deviceCount) + + +cdef nvmlReturn_t _nvmlGetExcludedDeviceInfoByIndex(unsigned int index, nvmlExcludedDeviceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGetExcludedDeviceInfoByIndex + _check_or_init_nvml() + if __nvmlGetExcludedDeviceInfoByIndex == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGetExcludedDeviceInfoByIndex is not found") + return (__nvmlGetExcludedDeviceInfoByIndex)( + index, info) + + +cdef nvmlReturn_t _nvmlDeviceSetMigMode(nvmlDevice_t device, unsigned int mode, nvmlReturn_t* activationStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetMigMode + _check_or_init_nvml() + if __nvmlDeviceSetMigMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetMigMode is not found") + return (__nvmlDeviceSetMigMode)( + device, mode, activationStatus) + + +cdef nvmlReturn_t _nvmlDeviceGetMigMode(nvmlDevice_t device, unsigned int* currentMode, unsigned int* pendingMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMigMode + _check_or_init_nvml() + if __nvmlDeviceGetMigMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMigMode is not found") + return (__nvmlDeviceGetMigMode)( + device, currentMode, pendingMode) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceProfileInfoV(nvmlDevice_t device, unsigned int profile, nvmlGpuInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstanceProfileInfoV + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstanceProfileInfoV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstanceProfileInfoV is not found") + return (__nvmlDeviceGetGpuInstanceProfileInfoV)( + device, profile, info) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstancePossiblePlacements_v2(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstancePlacement_t* placements, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstancePossiblePlacements_v2 + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstancePossiblePlacements_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstancePossiblePlacements_v2 is not found") + return (__nvmlDeviceGetGpuInstancePossiblePlacements_v2)( + device, profileId, placements, count) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceRemainingCapacity(nvmlDevice_t device, unsigned int profileId, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstanceRemainingCapacity + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstanceRemainingCapacity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstanceRemainingCapacity is not found") + return (__nvmlDeviceGetGpuInstanceRemainingCapacity)( + device, profileId, count) + + +cdef nvmlReturn_t _nvmlDeviceCreateGpuInstance(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceCreateGpuInstance + _check_or_init_nvml() + if __nvmlDeviceCreateGpuInstance == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceCreateGpuInstance is not found") + return (__nvmlDeviceCreateGpuInstance)( + device, profileId, gpuInstance) + + +cdef nvmlReturn_t _nvmlDeviceCreateGpuInstanceWithPlacement(nvmlDevice_t device, unsigned int profileId, const nvmlGpuInstancePlacement_t* placement, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceCreateGpuInstanceWithPlacement + _check_or_init_nvml() + if __nvmlDeviceCreateGpuInstanceWithPlacement == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceCreateGpuInstanceWithPlacement is not found") + return (__nvmlDeviceCreateGpuInstanceWithPlacement)( + device, profileId, placement, gpuInstance) + + +cdef nvmlReturn_t _nvmlGpuInstanceDestroy(nvmlGpuInstance_t gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceDestroy + _check_or_init_nvml() + if __nvmlGpuInstanceDestroy == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceDestroy is not found") + return (__nvmlGpuInstanceDestroy)( + gpuInstance) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstances(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t* gpuInstances, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstances + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstances == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstances is not found") + return (__nvmlDeviceGetGpuInstances)( + device, profileId, gpuInstances, count) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceById(nvmlDevice_t device, unsigned int id, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstanceById + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstanceById == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstanceById is not found") + return (__nvmlDeviceGetGpuInstanceById)( + device, id, gpuInstance) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetInfo(nvmlGpuInstance_t gpuInstance, nvmlGpuInstanceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetInfo + _check_or_init_nvml() + if __nvmlGpuInstanceGetInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetInfo is not found") + return (__nvmlGpuInstanceGetInfo)( + gpuInstance, info) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstanceProfileInfoV(nvmlGpuInstance_t gpuInstance, unsigned int profile, unsigned int engProfile, nvmlComputeInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetComputeInstanceProfileInfoV + _check_or_init_nvml() + if __nvmlGpuInstanceGetComputeInstanceProfileInfoV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetComputeInstanceProfileInfoV is not found") + return (__nvmlGpuInstanceGetComputeInstanceProfileInfoV)( + gpuInstance, profile, engProfile, info) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstanceRemainingCapacity(nvmlGpuInstance_t gpuInstance, unsigned int profileId, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetComputeInstanceRemainingCapacity + _check_or_init_nvml() + if __nvmlGpuInstanceGetComputeInstanceRemainingCapacity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetComputeInstanceRemainingCapacity is not found") + return (__nvmlGpuInstanceGetComputeInstanceRemainingCapacity)( + gpuInstance, profileId, count) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstancePossiblePlacements(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstancePlacement_t* placements, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetComputeInstancePossiblePlacements + _check_or_init_nvml() + if __nvmlGpuInstanceGetComputeInstancePossiblePlacements == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetComputeInstancePossiblePlacements is not found") + return (__nvmlGpuInstanceGetComputeInstancePossiblePlacements)( + gpuInstance, profileId, placements, count) + + +cdef nvmlReturn_t _nvmlGpuInstanceCreateComputeInstance(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceCreateComputeInstance + _check_or_init_nvml() + if __nvmlGpuInstanceCreateComputeInstance == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceCreateComputeInstance is not found") + return (__nvmlGpuInstanceCreateComputeInstance)( + gpuInstance, profileId, computeInstance) + + +cdef nvmlReturn_t _nvmlGpuInstanceCreateComputeInstanceWithPlacement(nvmlGpuInstance_t gpuInstance, unsigned int profileId, const nvmlComputeInstancePlacement_t* placement, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceCreateComputeInstanceWithPlacement + _check_or_init_nvml() + if __nvmlGpuInstanceCreateComputeInstanceWithPlacement == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceCreateComputeInstanceWithPlacement is not found") + return (__nvmlGpuInstanceCreateComputeInstanceWithPlacement)( + gpuInstance, profileId, placement, computeInstance) + + +cdef nvmlReturn_t _nvmlComputeInstanceDestroy(nvmlComputeInstance_t computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlComputeInstanceDestroy + _check_or_init_nvml() + if __nvmlComputeInstanceDestroy == NULL: + with gil: + raise FunctionNotFoundError("function nvmlComputeInstanceDestroy is not found") + return (__nvmlComputeInstanceDestroy)( + computeInstance) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstances(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t* computeInstances, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetComputeInstances + _check_or_init_nvml() + if __nvmlGpuInstanceGetComputeInstances == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetComputeInstances is not found") + return (__nvmlGpuInstanceGetComputeInstances)( + gpuInstance, profileId, computeInstances, count) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstanceById(nvmlGpuInstance_t gpuInstance, unsigned int id, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetComputeInstanceById + _check_or_init_nvml() + if __nvmlGpuInstanceGetComputeInstanceById == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetComputeInstanceById is not found") + return (__nvmlGpuInstanceGetComputeInstanceById)( + gpuInstance, id, computeInstance) + + +cdef nvmlReturn_t _nvmlComputeInstanceGetInfo_v2(nvmlComputeInstance_t computeInstance, nvmlComputeInstanceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlComputeInstanceGetInfo_v2 + _check_or_init_nvml() + if __nvmlComputeInstanceGetInfo_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlComputeInstanceGetInfo_v2 is not found") + return (__nvmlComputeInstanceGetInfo_v2)( + computeInstance, info) + + +cdef nvmlReturn_t _nvmlDeviceIsMigDeviceHandle(nvmlDevice_t device, unsigned int* isMigDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceIsMigDeviceHandle + _check_or_init_nvml() + if __nvmlDeviceIsMigDeviceHandle == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceIsMigDeviceHandle is not found") + return (__nvmlDeviceIsMigDeviceHandle)( + device, isMigDevice) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceId(nvmlDevice_t device, unsigned int* id) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstanceId + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstanceId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstanceId is not found") + return (__nvmlDeviceGetGpuInstanceId)( + device, id) + + +cdef nvmlReturn_t _nvmlDeviceGetComputeInstanceId(nvmlDevice_t device, unsigned int* id) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetComputeInstanceId + _check_or_init_nvml() + if __nvmlDeviceGetComputeInstanceId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetComputeInstanceId is not found") + return (__nvmlDeviceGetComputeInstanceId)( + device, id) + + +cdef nvmlReturn_t _nvmlDeviceGetMaxMigDeviceCount(nvmlDevice_t device, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMaxMigDeviceCount + _check_or_init_nvml() + if __nvmlDeviceGetMaxMigDeviceCount == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMaxMigDeviceCount is not found") + return (__nvmlDeviceGetMaxMigDeviceCount)( + device, count) + + +cdef nvmlReturn_t _nvmlDeviceGetMigDeviceHandleByIndex(nvmlDevice_t device, unsigned int index, nvmlDevice_t* migDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMigDeviceHandleByIndex + _check_or_init_nvml() + if __nvmlDeviceGetMigDeviceHandleByIndex == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMigDeviceHandleByIndex is not found") + return (__nvmlDeviceGetMigDeviceHandleByIndex)( + device, index, migDevice) + + +cdef nvmlReturn_t _nvmlDeviceGetDeviceHandleFromMigDeviceHandle(nvmlDevice_t migDevice, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDeviceHandleFromMigDeviceHandle + _check_or_init_nvml() + if __nvmlDeviceGetDeviceHandleFromMigDeviceHandle == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDeviceHandleFromMigDeviceHandle is not found") + return (__nvmlDeviceGetDeviceHandleFromMigDeviceHandle)( + migDevice, device) + + +cdef nvmlReturn_t _nvmlGpmSampleGet(nvmlDevice_t device, nvmlGpmSample_t gpmSample) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpmSampleGet + _check_or_init_nvml() + if __nvmlGpmSampleGet == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpmSampleGet is not found") + return (__nvmlGpmSampleGet)( + device, gpmSample) + + +cdef nvmlReturn_t _nvmlGpmMigSampleGet(nvmlDevice_t device, unsigned int gpuInstanceId, nvmlGpmSample_t gpmSample) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpmMigSampleGet + _check_or_init_nvml() + if __nvmlGpmMigSampleGet == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpmMigSampleGet is not found") + return (__nvmlGpmMigSampleGet)( + device, gpuInstanceId, gpmSample) + + +cdef nvmlReturn_t _nvmlGpmQueryDeviceSupport(nvmlDevice_t device, nvmlGpmSupport_t* gpmSupport) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpmQueryDeviceSupport + _check_or_init_nvml() + if __nvmlGpmQueryDeviceSupport == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpmQueryDeviceSupport is not found") + return (__nvmlGpmQueryDeviceSupport)( + device, gpmSupport) + + +cdef nvmlReturn_t _nvmlGpmQueryIfStreamingEnabled(nvmlDevice_t device, unsigned int* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpmQueryIfStreamingEnabled + _check_or_init_nvml() + if __nvmlGpmQueryIfStreamingEnabled == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpmQueryIfStreamingEnabled is not found") + return (__nvmlGpmQueryIfStreamingEnabled)( + device, state) + + +cdef nvmlReturn_t _nvmlGpmSetStreamingEnabled(nvmlDevice_t device, unsigned int state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpmSetStreamingEnabled + _check_or_init_nvml() + if __nvmlGpmSetStreamingEnabled == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpmSetStreamingEnabled is not found") + return (__nvmlGpmSetStreamingEnabled)( + device, state) + + +cdef nvmlReturn_t _nvmlDeviceGetCapabilities(nvmlDevice_t device, nvmlDeviceCapabilities_t* caps) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCapabilities + _check_or_init_nvml() + if __nvmlDeviceGetCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCapabilities is not found") + return (__nvmlDeviceGetCapabilities)( + device, caps) + + +cdef nvmlReturn_t _nvmlDeviceWorkloadPowerProfileClearRequestedProfiles(nvmlDevice_t device, nvmlWorkloadPowerProfileRequestedProfiles_t* requestedProfiles) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceWorkloadPowerProfileClearRequestedProfiles + _check_or_init_nvml() + if __nvmlDeviceWorkloadPowerProfileClearRequestedProfiles == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceWorkloadPowerProfileClearRequestedProfiles is not found") + return (__nvmlDeviceWorkloadPowerProfileClearRequestedProfiles)( + device, requestedProfiles) + + +cdef nvmlReturn_t _nvmlDevicePowerSmoothingActivatePresetProfile(nvmlDevice_t device, nvmlPowerSmoothingProfile_t* profile) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDevicePowerSmoothingActivatePresetProfile + _check_or_init_nvml() + if __nvmlDevicePowerSmoothingActivatePresetProfile == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDevicePowerSmoothingActivatePresetProfile is not found") + return (__nvmlDevicePowerSmoothingActivatePresetProfile)( + device, profile) + + +cdef nvmlReturn_t _nvmlDevicePowerSmoothingUpdatePresetProfileParam(nvmlDevice_t device, nvmlPowerSmoothingProfile_t* profile) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDevicePowerSmoothingUpdatePresetProfileParam + _check_or_init_nvml() + if __nvmlDevicePowerSmoothingUpdatePresetProfileParam == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDevicePowerSmoothingUpdatePresetProfileParam is not found") + return (__nvmlDevicePowerSmoothingUpdatePresetProfileParam)( + device, profile) + + +cdef nvmlReturn_t _nvmlDevicePowerSmoothingSetState(nvmlDevice_t device, nvmlPowerSmoothingState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDevicePowerSmoothingSetState + _check_or_init_nvml() + if __nvmlDevicePowerSmoothingSetState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDevicePowerSmoothingSetState is not found") + return (__nvmlDevicePowerSmoothingSetState)( + device, state) + + +cdef nvmlReturn_t _nvmlDeviceGetAddressingMode(nvmlDevice_t device, nvmlDeviceAddressingMode_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAddressingMode + _check_or_init_nvml() + if __nvmlDeviceGetAddressingMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAddressingMode is not found") + return (__nvmlDeviceGetAddressingMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceGetRepairStatus(nvmlDevice_t device, nvmlRepairStatus_t* repairStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRepairStatus + _check_or_init_nvml() + if __nvmlDeviceGetRepairStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRepairStatus is not found") + return (__nvmlDeviceGetRepairStatus)( + device, repairStatus) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t* powerMizerMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerMizerMode_v1 + _check_or_init_nvml() + if __nvmlDeviceGetPowerMizerMode_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerMizerMode_v1 is not found") + return (__nvmlDeviceGetPowerMizerMode_v1)( + device, powerMizerMode) + + +cdef nvmlReturn_t _nvmlDeviceSetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t* powerMizerMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetPowerMizerMode_v1 + _check_or_init_nvml() + if __nvmlDeviceSetPowerMizerMode_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetPowerMizerMode_v1 is not found") + return (__nvmlDeviceSetPowerMizerMode_v1)( + device, powerMizerMode) + + +cdef nvmlReturn_t _nvmlDeviceGetPdi(nvmlDevice_t device, nvmlPdi_t* pdi) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPdi + _check_or_init_nvml() + if __nvmlDeviceGetPdi == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPdi is not found") + return (__nvmlDeviceGetPdi)( + device, pdi) + + +cdef nvmlReturn_t _nvmlDeviceSetHostname_v1(nvmlDevice_t device, nvmlHostname_v1_t* hostname) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetHostname_v1 + _check_or_init_nvml() + if __nvmlDeviceSetHostname_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetHostname_v1 is not found") + return (__nvmlDeviceSetHostname_v1)( + device, hostname) + + +cdef nvmlReturn_t _nvmlDeviceGetHostname_v1(nvmlDevice_t device, nvmlHostname_v1_t* hostname) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHostname_v1 + _check_or_init_nvml() + if __nvmlDeviceGetHostname_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHostname_v1 is not found") + return (__nvmlDeviceGetHostname_v1)( + device, hostname) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkInfo(nvmlDevice_t device, nvmlNvLinkInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkInfo + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkInfo is not found") + return (__nvmlDeviceGetNvLinkInfo)( + device, info) + + +cdef nvmlReturn_t _nvmlDeviceReadWritePRM_v1(nvmlDevice_t device, nvmlPRMTLV_v1_t* buffer) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceReadWritePRM_v1 + _check_or_init_nvml() + if __nvmlDeviceReadWritePRM_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceReadWritePRM_v1 is not found") + return (__nvmlDeviceReadWritePRM_v1)( + device, buffer) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceProfileInfoByIdV(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstanceProfileInfoByIdV + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstanceProfileInfoByIdV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstanceProfileInfoByIdV is not found") + return (__nvmlDeviceGetGpuInstanceProfileInfoByIdV)( + device, profileId, info) + + +cdef nvmlReturn_t _nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(nvmlDevice_t device, nvmlEccSramUniqueUncorrectedErrorCounts_t* errorCounts) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts + _check_or_init_nvml() + if __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts is not found") + return (__nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts)( + device, errorCounts) diff --git a/cuda_bindings/cuda/bindings/cufile.pyx b/cuda_bindings/cuda/bindings/cufile.pyx index a4e5c23994..3cde8aa8fa 100644 --- a/cuda_bindings/cuda/bindings/cufile.pyx +++ b/cuda_bindings/cuda/bindings/cufile.pyx @@ -8,9 +8,6 @@ cimport cython # NOQA from libc cimport errno from ._internal.utils cimport (get_buffer_pointer, get_nested_resource_ptr, nested_resource) -import numpy as _numpy -from cpython cimport buffer as _buffer -from cpython.memoryview cimport PyMemoryView_FromMemory from enum import IntEnum as _IntEnum cimport cpython @@ -18,6 +15,23 @@ import cython from cuda.bindings.driver import CUresult as pyCUresult +from libc.stdlib cimport calloc, free, malloc +from cython cimport view +cimport cpython.buffer +cimport cpython.memoryview +from libc.string cimport memcmp, memcpy +import numpy as _numpy + + +cdef __from_data(data, dtype_name, expected_dtype, lowpp_type_from_ptr): + # _numpy.recarray is a subclass of _numpy.ndarray, so implicitly handled here. + 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) ############################################################################### # POD @@ -39,13 +53,22 @@ cdef class _py_anon_pod1: .. seealso:: `_anon_pod1` """ cdef: - readonly object _data + _anon_pod1 *_ptr + object _owner + bint _readonly + dict _refs def __init__(self): - arr = _numpy.empty(1, dtype=_py_anon_pod1_dtype) - self._data = arr.view(_numpy.recarray) - assert self._data.itemsize == sizeof((NULL).handle), \ - f"itemsize {self._data.itemsize} mismatches union size {sizeof((NULL).handle)}" + self._ptr = <_anon_pod1 *>calloc(1, sizeof((NULL).handle)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod1") + self._owner = None + self._readonly = False + self._refs = {} + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) def __repr__(self): return f"<{__name__}._py_anon_pod1 object at {hex(id(self))}>" @@ -53,81 +76,86 @@ cdef class _py_anon_pod1: @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" - return self._data.ctypes.data + return (self._ptr) cdef intptr_t _get_ptr(self): - """Get the pointer address to the data as Python :class:`int`.""" - return self._data.ctypes.data + return (self._ptr) def __int__(self): - return self._data.ctypes.data + return (self._ptr) def __eq__(self, other): + cdef _py_anon_pod1 other_ if not isinstance(other, _py_anon_pod1): return False - if self._data.size != other._data.size: - return False - if self._data.dtype != other._data.dtype: - return False - return bool((self._data == other._data).all()) + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof((NULL).handle)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = <_anon_pod1 *>malloc(sizeof((NULL).handle)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod1") + memcpy(self._ptr, val.ctypes.data, sizeof((NULL).handle)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) @property def fd(self): """int: """ - return int(self._data.fd[0]) + return self._ptr[0].fd @fd.setter def fd(self, val): - self._data.fd = val + if self._readonly: + raise ValueError("This _py_anon_pod1 instance is read-only") + self._ptr[0].fd = val @property def handle(self): """int: """ - return int(self._data.handle[0]) + return (self._ptr[0].handle) @handle.setter def handle(self, val): - self._data.handle = val - - def __setitem__(self, key, val): - self._data[key] = val + if self._readonly: + raise ValueError("This _py_anon_pod1 instance is read-only") + self._ptr[0].handle = val @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. + data (_numpy.ndarray): a single-element 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, _numpy.recarray)): - 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(_numpy.recarray) - - return obj + return __from_data(data, "_py_anon_pod1_dtype", _py_anon_pod1_dtype, _py_anon_pod1.from_ptr) @staticmethod - def from_ptr(intptr_t ptr, bint readonly=False): + def from_ptr(intptr_t ptr, 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. + 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_pod1 obj = _py_anon_pod1.__new__(_py_anon_pod1) - cdef flag = _buffer.PyBUF_READ if readonly else _buffer.PyBUF_WRITE - cdef object buf = PyMemoryView_FromMemory( - ptr, sizeof((NULL).handle), flag) - data = _numpy.ndarray((1,), buffer=buf, - dtype=_py_anon_pod1_dtype) - obj._data = data.view(_numpy.recarray) - + if owner is None: + obj._ptr = <_anon_pod1 *>malloc(sizeof((NULL).handle)) + if obj._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod1") + memcpy((obj._ptr), ptr, sizeof((NULL).handle)) + obj._owner = None + else: + obj._ptr = <_anon_pod1 *>ptr + obj._owner = owner + obj._readonly = readonly + obj._refs = {} return obj @@ -146,13 +174,22 @@ cdef class _py_anon_pod3: .. seealso:: `_anon_pod3` """ cdef: - readonly object _data + _anon_pod3 *_ptr + object _owner + bint _readonly + dict _refs def __init__(self): - arr = _numpy.empty(1, dtype=_py_anon_pod3_dtype) - self._data = arr.view(_numpy.recarray) - assert self._data.itemsize == sizeof((NULL).u.batch), \ - f"itemsize {self._data.itemsize} mismatches struct size {sizeof((NULL).u.batch)}" + self._ptr = <_anon_pod3 *>calloc(1, sizeof((NULL).u.batch)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod3") + self._owner = None + self._readonly = False + self._refs = {} + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) def __repr__(self): return f"<{__name__}._py_anon_pod3 object at {hex(id(self))}>" @@ -160,99 +197,108 @@ cdef class _py_anon_pod3: @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" - return self._data.ctypes.data + return (self._ptr) cdef intptr_t _get_ptr(self): - """Get the pointer address to the data as Python :class:`int`.""" - return self._data.ctypes.data + return (self._ptr) def __int__(self): - return self._data.ctypes.data + return (self._ptr) def __eq__(self, other): + cdef _py_anon_pod3 other_ if not isinstance(other, _py_anon_pod3): return False - if self._data.size != other._data.size: - return False - if self._data.dtype != other._data.dtype: - return False - return bool((self._data == other._data).all()) + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof((NULL).u.batch)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = <_anon_pod3 *>malloc(sizeof((NULL).u.batch)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod3") + memcpy(self._ptr, val.ctypes.data, sizeof((NULL).u.batch)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) @property def dev_ptr_base(self): """int: """ - return int(self._data.dev_ptr_base[0]) + return (self._ptr[0].devPtr_base) @dev_ptr_base.setter def dev_ptr_base(self, val): - self._data.dev_ptr_base = val + if self._readonly: + raise ValueError("This _py_anon_pod3 instance is read-only") + self._ptr[0].devPtr_base = val @property def file_offset(self): """int: """ - return int(self._data.file_offset[0]) + return self._ptr[0].file_offset @file_offset.setter def file_offset(self, val): - self._data.file_offset = val + if self._readonly: + raise ValueError("This _py_anon_pod3 instance is read-only") + self._ptr[0].file_offset = val @property def dev_ptr_offset(self): """int: """ - return int(self._data.dev_ptr_offset[0]) + return self._ptr[0].devPtr_offset @dev_ptr_offset.setter def dev_ptr_offset(self, val): - self._data.dev_ptr_offset = val + if self._readonly: + raise ValueError("This _py_anon_pod3 instance is read-only") + self._ptr[0].devPtr_offset = val @property def size_(self): """int: """ - return int(self._data.size_[0]) + return self._ptr[0].size @size_.setter def size_(self, val): - self._data.size_ = val - - def __setitem__(self, key, val): - self._data[key] = val + if self._readonly: + raise ValueError("This _py_anon_pod3 instance is read-only") + self._ptr[0].size = val @staticmethod def from_data(data): """Create an _py_anon_pod3 instance wrapping the given NumPy array. Args: - data (_numpy.ndarray): a 1D array of dtype `_py_anon_pod3_dtype` holding the data. + data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod3_dtype` holding the data. """ - cdef _py_anon_pod3 obj = _py_anon_pod3.__new__(_py_anon_pod3) - if not isinstance(data, (_numpy.ndarray, _numpy.recarray)): - 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_pod3_dtype: - raise ValueError("data array must be of dtype _py_anon_pod3_dtype") - obj._data = data.view(_numpy.recarray) - - return obj + return __from_data(data, "_py_anon_pod3_dtype", _py_anon_pod3_dtype, _py_anon_pod3.from_ptr) @staticmethod - def from_ptr(intptr_t ptr, bint readonly=False): + 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) - cdef flag = _buffer.PyBUF_READ if readonly else _buffer.PyBUF_WRITE - cdef object buf = PyMemoryView_FromMemory( - ptr, sizeof((NULL).u.batch), flag) - data = _numpy.ndarray((1,), buffer=buf, - dtype=_py_anon_pod3_dtype) - obj._data = data.view(_numpy.recarray) - + if owner is None: + obj._ptr = <_anon_pod3 *>malloc(sizeof((NULL).u.batch)) + if obj._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod3") + memcpy((obj._ptr), ptr, sizeof((NULL).u.batch)) + obj._owner = None + else: + obj._ptr = <_anon_pod3 *>ptr + obj._owner = owner + obj._readonly = readonly + obj._refs = {} return obj @@ -278,11 +324,13 @@ cdef class IOEvents: cdef: readonly object _data + + def __init__(self, size=1): arr = _numpy.empty(size, dtype=io_events_dtype) self._data = arr.view(_numpy.recarray) assert self._data.itemsize == sizeof(CUfileIOEvents_t), \ - f"itemsize {self._data.itemsize} mismatches struct size {sizeof(CUfileIOEvents_t)}" + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(CUfileIOEvents_t) }" def __repr__(self): if self._data.size > 1: @@ -296,7 +344,6 @@ cdef class IOEvents: return self._data.ctypes.data cdef intptr_t _get_ptr(self): - """Get the pointer address to the data as Python :class:`int`.""" return self._data.ctypes.data def __int__(self): @@ -309,13 +356,10 @@ cdef class IOEvents: return self._data.size def __eq__(self, other): - if not isinstance(other, IOEvents): + cdef object self_data = self._data + if (not isinstance(other, IOEvents)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: return False - if self._data.size != other._data.size: - return False - if self._data.dtype != other._data.dtype: - return False - return bool((self._data == other._data).all()) + return bool((self_data == other._data).all()) @property def cookie(self): @@ -351,13 +395,16 @@ cdef class IOEvents: self._data.ret = val def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size if isinstance(key, int): + key_ = key size = self._data.size - if key >= size or key <= -(size+1): + if key_ >= size or key_ <= -(size+1): raise IndexError("index is out of bounds") - if key < 0: - key += size - return IOEvents.from_data(self._data[key:key+1]) + if key_ < 0: + key_ += size + return IOEvents.from_data(self._data[key_:key_+1]) out = self._data[key] if isinstance(out, _numpy.recarray) and out.dtype == io_events_dtype: return IOEvents.from_data(out) @@ -374,7 +421,7 @@ cdef class IOEvents: data (_numpy.ndarray): a 1D array of dtype `io_events_dtype` holding the data. """ cdef IOEvents obj = IOEvents.__new__(IOEvents) - if not isinstance(data, (_numpy.ndarray, _numpy.recarray)): + 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") @@ -396,11 +443,10 @@ cdef class IOEvents: if ptr == 0: raise ValueError("ptr must not be null (0)") cdef IOEvents obj = IOEvents.__new__(IOEvents) - cdef flag = _buffer.PyBUF_READ if readonly else _buffer.PyBUF_WRITE - cdef object buf = PyMemoryView_FromMemory( + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( ptr, sizeof(CUfileIOEvents_t) * size, flag) - data = _numpy.ndarray((size,), buffer=buf, - dtype=io_events_dtype) + data = _numpy.ndarray(size, buffer=buf, dtype=io_events_dtype) obj._data = data.view(_numpy.recarray) return obj @@ -419,13 +465,20 @@ cdef class OpCounter: .. seealso:: `CUfileOpCounter_t` """ cdef: - readonly object _data + CUfileOpCounter_t *_ptr + object _owner + bint _readonly def __init__(self): - arr = _numpy.empty(1, dtype=op_counter_dtype) - self._data = arr.view(_numpy.recarray) - assert self._data.itemsize == sizeof(CUfileOpCounter_t), \ - f"itemsize {self._data.itemsize} mismatches struct size {sizeof(CUfileOpCounter_t)}" + self._ptr = calloc(1, sizeof(CUfileOpCounter_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating OpCounter") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) def __repr__(self): return f"<{__name__}.OpCounter object at {hex(id(self))}>" @@ -433,81 +486,85 @@ cdef class OpCounter: @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" - return self._data.ctypes.data + return (self._ptr) cdef intptr_t _get_ptr(self): - """Get the pointer address to the data as Python :class:`int`.""" - return self._data.ctypes.data + return (self._ptr) def __int__(self): - return self._data.ctypes.data + return (self._ptr) def __eq__(self, other): + cdef OpCounter other_ if not isinstance(other, OpCounter): return False - if self._data.size != other._data.size: - return False - if self._data.dtype != other._data.dtype: - return False - return bool((self._data == other._data).all()) + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof(CUfileOpCounter_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(CUfileOpCounter_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating OpCounter") + memcpy(self._ptr, val.ctypes.data, sizeof(CUfileOpCounter_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) @property def ok(self): """int: """ - return int(self._data.ok[0]) + return self._ptr[0].ok @ok.setter def ok(self, val): - self._data.ok = val + if self._readonly: + raise ValueError("This OpCounter instance is read-only") + self._ptr[0].ok = val @property def err(self): """int: """ - return int(self._data.err[0]) + return self._ptr[0].err @err.setter def err(self, val): - self._data.err = val - - def __setitem__(self, key, val): - self._data[key] = val + if self._readonly: + raise ValueError("This OpCounter instance is read-only") + self._ptr[0].err = val @staticmethod def from_data(data): """Create an OpCounter instance wrapping the given NumPy array. Args: - data (_numpy.ndarray): a 1D array of dtype `op_counter_dtype` holding the data. + data (_numpy.ndarray): a single-element array of dtype `op_counter_dtype` holding the data. """ - cdef OpCounter obj = OpCounter.__new__(OpCounter) - if not isinstance(data, (_numpy.ndarray, _numpy.recarray)): - raise TypeError("data argument must be a NumPy ndarray") - if data.ndim != 1: - raise ValueError("data array must be 1D") - if data.dtype != op_counter_dtype: - raise ValueError("data array must be of dtype op_counter_dtype") - obj._data = data.view(_numpy.recarray) - - return obj + return __from_data(data, "op_counter_dtype", op_counter_dtype, OpCounter.from_ptr) @staticmethod - def from_ptr(intptr_t ptr, bint readonly=False): + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an OpCounter 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 OpCounter obj = OpCounter.__new__(OpCounter) - cdef flag = _buffer.PyBUF_READ if readonly else _buffer.PyBUF_WRITE - cdef object buf = PyMemoryView_FromMemory( - ptr, sizeof(CUfileOpCounter_t), flag) - data = _numpy.ndarray((1,), buffer=buf, - dtype=op_counter_dtype) - obj._data = data.view(_numpy.recarray) - + if owner is None: + obj._ptr = malloc(sizeof(CUfileOpCounter_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating OpCounter") + memcpy((obj._ptr), ptr, sizeof(CUfileOpCounter_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly return obj @@ -552,13 +609,20 @@ cdef class PerGpuStats: .. seealso:: `CUfilePerGpuStats_t` """ cdef: - readonly object _data + CUfilePerGpuStats_t *_ptr + object _owner + bint _readonly def __init__(self): - arr = _numpy.empty(1, dtype=per_gpu_stats_dtype) - self._data = arr.view(_numpy.recarray) - assert self._data.itemsize == sizeof(CUfilePerGpuStats_t), \ - f"itemsize {self._data.itemsize} mismatches struct size {sizeof(CUfilePerGpuStats_t)}" + self._ptr = calloc(1, sizeof(CUfilePerGpuStats_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PerGpuStats") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) def __repr__(self): return f"<{__name__}.PerGpuStats object at {hex(id(self))}>" @@ -566,333 +630,397 @@ cdef class PerGpuStats: @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" - return self._data.ctypes.data + return (self._ptr) cdef intptr_t _get_ptr(self): - """Get the pointer address to the data as Python :class:`int`.""" - return self._data.ctypes.data + return (self._ptr) def __int__(self): - return self._data.ctypes.data + return (self._ptr) def __eq__(self, other): + cdef PerGpuStats other_ if not isinstance(other, PerGpuStats): return False - if self._data.size != other._data.size: - return False - if self._data.dtype != other._data.dtype: - return False - return bool((self._data == other._data).all()) + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof(CUfilePerGpuStats_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(CUfilePerGpuStats_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PerGpuStats") + memcpy(self._ptr, val.ctypes.data, sizeof(CUfilePerGpuStats_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) @property def uuid(self): """~_numpy.int8: (array of length 16).""" - return self._data.uuid + return cpython.PyUnicode_FromString(self._ptr[0].uuid) @uuid.setter def uuid(self, val): - self._data.uuid = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 16: + raise ValueError("String too long for field uuid, max length is 15") + cdef char *ptr = buf + memcpy((self._ptr[0].uuid), ptr, 16) @property def read_bytes(self): """int: """ - return int(self._data.read_bytes[0]) + return self._ptr[0].read_bytes @read_bytes.setter def read_bytes(self, val): - self._data.read_bytes = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].read_bytes = val @property def read_bw_bytes_per_sec(self): """int: """ - return int(self._data.read_bw_bytes_per_sec[0]) + return self._ptr[0].read_bw_bytes_per_sec @read_bw_bytes_per_sec.setter def read_bw_bytes_per_sec(self, val): - self._data.read_bw_bytes_per_sec = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].read_bw_bytes_per_sec = val @property def read_utilization(self): """int: """ - return int(self._data.read_utilization[0]) + return self._ptr[0].read_utilization @read_utilization.setter def read_utilization(self, val): - self._data.read_utilization = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].read_utilization = val @property def read_duration_us(self): """int: """ - return int(self._data.read_duration_us[0]) + return self._ptr[0].read_duration_us @read_duration_us.setter def read_duration_us(self, val): - self._data.read_duration_us = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].read_duration_us = val @property def n_total_reads(self): """int: """ - return int(self._data.n_total_reads[0]) + return self._ptr[0].n_total_reads @n_total_reads.setter def n_total_reads(self, val): - self._data.n_total_reads = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].n_total_reads = val @property def n_p2p_reads(self): """int: """ - return int(self._data.n_p2p_reads[0]) + return self._ptr[0].n_p2p_reads @n_p2p_reads.setter def n_p2p_reads(self, val): - self._data.n_p2p_reads = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].n_p2p_reads = val @property def n_nvfs_reads(self): """int: """ - return int(self._data.n_nvfs_reads[0]) + return self._ptr[0].n_nvfs_reads @n_nvfs_reads.setter def n_nvfs_reads(self, val): - self._data.n_nvfs_reads = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].n_nvfs_reads = val @property def n_posix_reads(self): """int: """ - return int(self._data.n_posix_reads[0]) + return self._ptr[0].n_posix_reads @n_posix_reads.setter def n_posix_reads(self, val): - self._data.n_posix_reads = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].n_posix_reads = val @property def n_unaligned_reads(self): """int: """ - return int(self._data.n_unaligned_reads[0]) + return self._ptr[0].n_unaligned_reads @n_unaligned_reads.setter def n_unaligned_reads(self, val): - self._data.n_unaligned_reads = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].n_unaligned_reads = val @property def n_dr_reads(self): """int: """ - return int(self._data.n_dr_reads[0]) + return self._ptr[0].n_dr_reads @n_dr_reads.setter def n_dr_reads(self, val): - self._data.n_dr_reads = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].n_dr_reads = val @property def n_sparse_regions(self): """int: """ - return int(self._data.n_sparse_regions[0]) + return self._ptr[0].n_sparse_regions @n_sparse_regions.setter def n_sparse_regions(self, val): - self._data.n_sparse_regions = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].n_sparse_regions = val @property def n_inline_regions(self): """int: """ - return int(self._data.n_inline_regions[0]) + return self._ptr[0].n_inline_regions @n_inline_regions.setter def n_inline_regions(self, val): - self._data.n_inline_regions = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].n_inline_regions = val @property def n_reads_err(self): """int: """ - return int(self._data.n_reads_err[0]) + return self._ptr[0].n_reads_err @n_reads_err.setter def n_reads_err(self, val): - self._data.n_reads_err = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].n_reads_err = val @property def writes_bytes(self): """int: """ - return int(self._data.writes_bytes[0]) + return self._ptr[0].writes_bytes @writes_bytes.setter def writes_bytes(self, val): - self._data.writes_bytes = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].writes_bytes = val @property def write_bw_bytes_per_sec(self): """int: """ - return int(self._data.write_bw_bytes_per_sec[0]) + return self._ptr[0].write_bw_bytes_per_sec @write_bw_bytes_per_sec.setter def write_bw_bytes_per_sec(self, val): - self._data.write_bw_bytes_per_sec = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].write_bw_bytes_per_sec = val @property def write_utilization(self): """int: """ - return int(self._data.write_utilization[0]) + return self._ptr[0].write_utilization @write_utilization.setter def write_utilization(self, val): - self._data.write_utilization = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].write_utilization = val @property def write_duration_us(self): """int: """ - return int(self._data.write_duration_us[0]) + return self._ptr[0].write_duration_us @write_duration_us.setter def write_duration_us(self, val): - self._data.write_duration_us = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].write_duration_us = val @property def n_total_writes(self): """int: """ - return int(self._data.n_total_writes[0]) + return self._ptr[0].n_total_writes @n_total_writes.setter def n_total_writes(self, val): - self._data.n_total_writes = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].n_total_writes = val @property def n_p2p_writes(self): """int: """ - return int(self._data.n_p2p_writes[0]) + return self._ptr[0].n_p2p_writes @n_p2p_writes.setter def n_p2p_writes(self, val): - self._data.n_p2p_writes = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].n_p2p_writes = val @property def n_nvfs_writes(self): """int: """ - return int(self._data.n_nvfs_writes[0]) + return self._ptr[0].n_nvfs_writes @n_nvfs_writes.setter def n_nvfs_writes(self, val): - self._data.n_nvfs_writes = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].n_nvfs_writes = val @property def n_posix_writes(self): """int: """ - return int(self._data.n_posix_writes[0]) + return self._ptr[0].n_posix_writes @n_posix_writes.setter def n_posix_writes(self, val): - self._data.n_posix_writes = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].n_posix_writes = val @property def n_unaligned_writes(self): """int: """ - return int(self._data.n_unaligned_writes[0]) + return self._ptr[0].n_unaligned_writes @n_unaligned_writes.setter def n_unaligned_writes(self, val): - self._data.n_unaligned_writes = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].n_unaligned_writes = val @property def n_dr_writes(self): """int: """ - return int(self._data.n_dr_writes[0]) + return self._ptr[0].n_dr_writes @n_dr_writes.setter def n_dr_writes(self, val): - self._data.n_dr_writes = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].n_dr_writes = val @property def n_writes_err(self): """int: """ - return int(self._data.n_writes_err[0]) + return self._ptr[0].n_writes_err @n_writes_err.setter def n_writes_err(self, val): - self._data.n_writes_err = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].n_writes_err = val @property def n_mmap(self): """int: """ - return int(self._data.n_mmap[0]) + return self._ptr[0].n_mmap @n_mmap.setter def n_mmap(self, val): - self._data.n_mmap = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].n_mmap = val @property def n_mmap_ok(self): """int: """ - return int(self._data.n_mmap_ok[0]) + return self._ptr[0].n_mmap_ok @n_mmap_ok.setter def n_mmap_ok(self, val): - self._data.n_mmap_ok = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].n_mmap_ok = val @property def n_mmap_err(self): """int: """ - return int(self._data.n_mmap_err[0]) + return self._ptr[0].n_mmap_err @n_mmap_err.setter def n_mmap_err(self, val): - self._data.n_mmap_err = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].n_mmap_err = val @property def n_mmap_free(self): """int: """ - return int(self._data.n_mmap_free[0]) + return self._ptr[0].n_mmap_free @n_mmap_free.setter def n_mmap_free(self, val): - self._data.n_mmap_free = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].n_mmap_free = val @property def reg_bytes(self): """int: """ - return int(self._data.reg_bytes[0]) + return self._ptr[0].reg_bytes @reg_bytes.setter def reg_bytes(self, val): - self._data.reg_bytes = val - - def __setitem__(self, key, val): - self._data[key] = val + if self._readonly: + raise ValueError("This PerGpuStats instance is read-only") + self._ptr[0].reg_bytes = val @staticmethod def from_data(data): """Create an PerGpuStats instance wrapping the given NumPy array. Args: - data (_numpy.ndarray): a 1D array of dtype `per_gpu_stats_dtype` holding the data. + data (_numpy.ndarray): a single-element array of dtype `per_gpu_stats_dtype` holding the data. """ - cdef PerGpuStats obj = PerGpuStats.__new__(PerGpuStats) - if not isinstance(data, (_numpy.ndarray, _numpy.recarray)): - raise TypeError("data argument must be a NumPy ndarray") - if data.ndim != 1: - raise ValueError("data array must be 1D") - if data.dtype != per_gpu_stats_dtype: - raise ValueError("data array must be of dtype per_gpu_stats_dtype") - obj._data = data.view(_numpy.recarray) - - return obj + return __from_data(data, "per_gpu_stats_dtype", per_gpu_stats_dtype, PerGpuStats.from_ptr) @staticmethod - def from_ptr(intptr_t ptr, bint readonly=False): + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an PerGpuStats 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 PerGpuStats obj = PerGpuStats.__new__(PerGpuStats) - cdef flag = _buffer.PyBUF_READ if readonly else _buffer.PyBUF_WRITE - cdef object buf = PyMemoryView_FromMemory( - ptr, sizeof(CUfilePerGpuStats_t), flag) - data = _numpy.ndarray((1,), buffer=buf, - dtype=per_gpu_stats_dtype) - obj._data = data.view(_numpy.recarray) - + if owner is None: + obj._ptr = malloc(sizeof(CUfilePerGpuStats_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating PerGpuStats") + memcpy((obj._ptr), ptr, sizeof(CUfilePerGpuStats_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly return obj @@ -918,11 +1046,15 @@ cdef class Descr: cdef: readonly object _data + readonly tuple _handle + + + def __init__(self, size=1): arr = _numpy.empty(size, dtype=descr_dtype) self._data = arr.view(_numpy.recarray) assert self._data.itemsize == sizeof(CUfileDescr_t), \ - f"itemsize {self._data.itemsize} mismatches struct size {sizeof(CUfileDescr_t)}" + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(CUfileDescr_t) }" def __repr__(self): if self._data.size > 1: @@ -936,7 +1068,6 @@ cdef class Descr: return self._data.ctypes.data cdef intptr_t _get_ptr(self): - """Get the pointer address to the data as Python :class:`int`.""" return self._data.ctypes.data def __int__(self): @@ -949,13 +1080,17 @@ cdef class Descr: return self._data.size def __eq__(self, other): - if not isinstance(other, Descr): - return False - if self._data.size != other._data.size: - return False - if self._data.dtype != other._data.dtype: + cdef object self_data = self._data + if (not isinstance(other, Descr)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: return False - return bool((self._data == other._data).all()) + return bool((self_data == other._data).all()) + + @property + def handle(self): + """_py_anon_pod1: """ + if self._data.size == 1: + return self._handle[0] + return self._handle @property def type(self): @@ -968,15 +1103,6 @@ cdef class Descr: def type(self, val): self._data.type = val - @property - def handle(self): - """_py_anon_pod1_dtype: """ - return self._data.handle - - @handle.setter - def handle(self, val): - self._data.handle = val - @property def fs_ops(self): """Union[~_numpy.intp, int]: """ @@ -989,13 +1115,16 @@ cdef class Descr: self._data.fs_ops = val def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size if isinstance(key, int): + key_ = key size = self._data.size - if key >= size or key <= -(size+1): + if key_ >= size or key_ <= -(size+1): raise IndexError("index is out of bounds") - if key < 0: - key += size - return Descr.from_data(self._data[key:key+1]) + if key_ < 0: + key_ += size + return Descr.from_data(self._data[key_:key_+1]) out = self._data[key] if isinstance(out, _numpy.recarray) and out.dtype == descr_dtype: return Descr.from_data(out) @@ -1012,7 +1141,7 @@ cdef class Descr: data (_numpy.ndarray): a 1D array of dtype `descr_dtype` holding the data. """ cdef Descr obj = Descr.__new__(Descr) - if not isinstance(data, (_numpy.ndarray, _numpy.recarray)): + 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") @@ -1020,6 +1149,13 @@ cdef class Descr: raise ValueError("data array must be of dtype descr_dtype") obj._data = data.view(_numpy.recarray) + handle_list = list() + for i in range(obj._data.size): + addr = obj._data.handle[i].__array_interface__['data'][0] + _py_anon_pod1_obj = _py_anon_pod1.from_ptr(addr, owner=obj) + handle_list.append(_py_anon_pod1_obj) + + obj._handle = tuple(handle_list) return obj @staticmethod @@ -1034,13 +1170,19 @@ cdef class Descr: if ptr == 0: raise ValueError("ptr must not be null (0)") cdef Descr obj = Descr.__new__(Descr) - cdef flag = _buffer.PyBUF_READ if readonly else _buffer.PyBUF_WRITE - cdef object buf = PyMemoryView_FromMemory( + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( ptr, sizeof(CUfileDescr_t) * size, flag) - data = _numpy.ndarray((size,), buffer=buf, - dtype=descr_dtype) + data = _numpy.ndarray(size, buffer=buf, dtype=descr_dtype) obj._data = data.view(_numpy.recarray) + handle_list = list() + for i in range(obj._data.size): + addr = obj._data.handle[i].__array_interface__['data'][0] + _py_anon_pod1_obj = _py_anon_pod1.from_ptr(addr, owner=obj) + handle_list.append(_py_anon_pod1_obj) + + obj._handle = tuple(handle_list) return obj @@ -1059,15 +1201,20 @@ cdef class _py_anon_pod2: .. seealso:: `_anon_pod2` """ cdef: - readonly object _data - - readonly object _batch + _anon_pod2 *_ptr + object _owner + bint _readonly def __init__(self): - arr = _numpy.empty(1, dtype=_py_anon_pod2_dtype) - self._data = arr.view(_numpy.recarray) - assert self._data.itemsize == sizeof((NULL).u), \ - f"itemsize {self._data.itemsize} mismatches union size {sizeof((NULL).u)}" + self._ptr = <_anon_pod2 *>calloc(1, sizeof((NULL).u)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod2") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) def __repr__(self): return f"<{__name__}._py_anon_pod2 object at {hex(id(self))}>" @@ -1075,72 +1222,75 @@ cdef class _py_anon_pod2: @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" - return self._data.ctypes.data + return (self._ptr) cdef intptr_t _get_ptr(self): - """Get the pointer address to the data as Python :class:`int`.""" - return self._data.ctypes.data + return (self._ptr) def __int__(self): - return self._data.ctypes.data + return (self._ptr) def __eq__(self, other): + cdef _py_anon_pod2 other_ if not isinstance(other, _py_anon_pod2): return False - if self._data.size != other._data.size: - return False - if self._data.dtype != other._data.dtype: - return False - return bool((self._data == other._data).all()) + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof((NULL).u)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = <_anon_pod2 *>malloc(sizeof((NULL).u)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod2") + memcpy(self._ptr, val.ctypes.data, sizeof((NULL).u)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) @property def batch(self): """_py_anon_pod3: """ - return self._batch + return _py_anon_pod3.from_ptr(&(self._ptr[0].batch), self._readonly, self) - def __setitem__(self, key, val): - self._data[key] = val + @batch.setter + def batch(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod2 instance is read-only") + cdef _py_anon_pod3 val_ = val + memcpy(&(self._ptr[0].batch), (val_._get_ptr()), sizeof(_anon_pod3) * 1) @staticmethod def from_data(data): """Create an _py_anon_pod2 instance wrapping the given NumPy array. Args: - data (_numpy.ndarray): a 1D array of dtype `_py_anon_pod2_dtype` holding the data. + data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod2_dtype` holding the data. """ - cdef _py_anon_pod2 obj = _py_anon_pod2.__new__(_py_anon_pod2) - if not isinstance(data, (_numpy.ndarray, _numpy.recarray)): - 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_pod2_dtype: - raise ValueError("data array must be of dtype _py_anon_pod2_dtype") - obj._data = data.view(_numpy.recarray) - - batch_addr = obj._data.batch[0].__array_interface__['data'][0] - obj._batch = _py_anon_pod3.from_ptr(batch_addr) - return obj + return __from_data(data, "_py_anon_pod2_dtype", _py_anon_pod2_dtype, _py_anon_pod2.from_ptr) @staticmethod - def from_ptr(intptr_t ptr, bint readonly=False): + 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) - cdef flag = _buffer.PyBUF_READ if readonly else _buffer.PyBUF_WRITE - cdef object buf = PyMemoryView_FromMemory( - ptr, sizeof((NULL).u), flag) - data = _numpy.ndarray((1,), buffer=buf, - dtype=_py_anon_pod2_dtype) - obj._data = data.view(_numpy.recarray) - - batch_addr = obj._data.batch[0].__array_interface__['data'][0] - obj._batch = _py_anon_pod3.from_ptr(batch_addr) + if owner is None: + obj._ptr = <_anon_pod2 *>malloc(sizeof((NULL).u)) + if obj._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod2") + memcpy((obj._ptr), ptr, sizeof((NULL).u)) + obj._owner = None + else: + obj._ptr = <_anon_pod2 *>ptr + obj._owner = owner + obj._readonly = readonly return obj @@ -1198,13 +1348,20 @@ cdef class StatsLevel1: .. seealso:: `CUfileStatsLevel1_t` """ cdef: - readonly object _data + CUfileStatsLevel1_t *_ptr + object _owner + bint _readonly def __init__(self): - arr = _numpy.empty(1, dtype=stats_level1_dtype) - self._data = arr.view(_numpy.recarray) - assert self._data.itemsize == sizeof(CUfileStatsLevel1_t), \ - f"itemsize {self._data.itemsize} mismatches struct size {sizeof(CUfileStatsLevel1_t)}" + self._ptr = calloc(1, sizeof(CUfileStatsLevel1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating StatsLevel1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) def __repr__(self): return f"<{__name__}.StatsLevel1 object at {hex(id(self))}>" @@ -1212,450 +1369,557 @@ cdef class StatsLevel1: @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" - return self._data.ctypes.data + return (self._ptr) cdef intptr_t _get_ptr(self): - """Get the pointer address to the data as Python :class:`int`.""" - return self._data.ctypes.data + return (self._ptr) def __int__(self): - return self._data.ctypes.data + return (self._ptr) def __eq__(self, other): + cdef StatsLevel1 other_ if not isinstance(other, StatsLevel1): return False - if self._data.size != other._data.size: - return False - if self._data.dtype != other._data.dtype: - return False - return bool((self._data == other._data).all()) + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof(CUfileStatsLevel1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(CUfileStatsLevel1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating StatsLevel1") + memcpy(self._ptr, val.ctypes.data, sizeof(CUfileStatsLevel1_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) @property def read_ops(self): - """: """ - return self._data.read_ops + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].read_ops), self._readonly, self) @read_ops.setter def read_ops(self, val): - self._data.read_ops = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + memcpy(&(self._ptr[0].read_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) @property def write_ops(self): - """: """ - return self._data.write_ops + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].write_ops), self._readonly, self) @write_ops.setter def write_ops(self, val): - self._data.write_ops = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + memcpy(&(self._ptr[0].write_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) @property def hdl_register_ops(self): - """: """ - return self._data.hdl_register_ops + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].hdl_register_ops), self._readonly, self) @hdl_register_ops.setter def hdl_register_ops(self, val): - self._data.hdl_register_ops = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + memcpy(&(self._ptr[0].hdl_register_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) @property def hdl_deregister_ops(self): - """: """ - return self._data.hdl_deregister_ops + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].hdl_deregister_ops), self._readonly, self) @hdl_deregister_ops.setter def hdl_deregister_ops(self, val): - self._data.hdl_deregister_ops = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + memcpy(&(self._ptr[0].hdl_deregister_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) @property def buf_register_ops(self): - """: """ - return self._data.buf_register_ops + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].buf_register_ops), self._readonly, self) @buf_register_ops.setter def buf_register_ops(self, val): - self._data.buf_register_ops = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + memcpy(&(self._ptr[0].buf_register_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) @property def buf_deregister_ops(self): - """: """ - return self._data.buf_deregister_ops + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].buf_deregister_ops), self._readonly, self) @buf_deregister_ops.setter def buf_deregister_ops(self, val): - self._data.buf_deregister_ops = val - - @property - def read_bytes(self): - """int: """ - return int(self._data.read_bytes[0]) - - @read_bytes.setter - def read_bytes(self, val): - self._data.read_bytes = val - - @property - def write_bytes(self): - """int: """ - return int(self._data.write_bytes[0]) - - @write_bytes.setter - def write_bytes(self, val): - self._data.write_bytes = val - - @property - def read_bw_bytes_per_sec(self): - """int: """ - return int(self._data.read_bw_bytes_per_sec[0]) - - @read_bw_bytes_per_sec.setter - def read_bw_bytes_per_sec(self, val): - self._data.read_bw_bytes_per_sec = val - - @property - def write_bw_bytes_per_sec(self): - """int: """ - return int(self._data.write_bw_bytes_per_sec[0]) - - @write_bw_bytes_per_sec.setter - def write_bw_bytes_per_sec(self, val): - self._data.write_bw_bytes_per_sec = val - - @property - def read_lat_avg_us(self): - """int: """ - return int(self._data.read_lat_avg_us[0]) - - @read_lat_avg_us.setter - def read_lat_avg_us(self, val): - self._data.read_lat_avg_us = val - - @property - def write_lat_avg_us(self): - """int: """ - return int(self._data.write_lat_avg_us[0]) - - @write_lat_avg_us.setter - def write_lat_avg_us(self, val): - self._data.write_lat_avg_us = val - - @property - def read_ops_per_sec(self): - """int: """ - return int(self._data.read_ops_per_sec[0]) - - @read_ops_per_sec.setter - def read_ops_per_sec(self, val): - self._data.read_ops_per_sec = val - - @property - def write_ops_per_sec(self): - """int: """ - return int(self._data.write_ops_per_sec[0]) - - @write_ops_per_sec.setter - def write_ops_per_sec(self, val): - self._data.write_ops_per_sec = val - - @property - def read_lat_sum_us(self): - """int: """ - return int(self._data.read_lat_sum_us[0]) - - @read_lat_sum_us.setter - def read_lat_sum_us(self, val): - self._data.read_lat_sum_us = val - - @property - def write_lat_sum_us(self): - """int: """ - return int(self._data.write_lat_sum_us[0]) - - @write_lat_sum_us.setter - def write_lat_sum_us(self, val): - self._data.write_lat_sum_us = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + memcpy(&(self._ptr[0].buf_deregister_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) @property def batch_submit_ops(self): - """: """ - return self._data.batch_submit_ops + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_submit_ops), self._readonly, self) @batch_submit_ops.setter def batch_submit_ops(self, val): - self._data.batch_submit_ops = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + memcpy(&(self._ptr[0].batch_submit_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) @property def batch_complete_ops(self): - """: """ - return self._data.batch_complete_ops + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_complete_ops), self._readonly, self) @batch_complete_ops.setter def batch_complete_ops(self, val): - self._data.batch_complete_ops = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + memcpy(&(self._ptr[0].batch_complete_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) @property def batch_setup_ops(self): - """: """ - return self._data.batch_setup_ops + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_setup_ops), self._readonly, self) @batch_setup_ops.setter def batch_setup_ops(self, val): - self._data.batch_setup_ops = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + memcpy(&(self._ptr[0].batch_setup_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) @property def batch_cancel_ops(self): - """: """ - return self._data.batch_cancel_ops + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_cancel_ops), self._readonly, self) @batch_cancel_ops.setter def batch_cancel_ops(self, val): - self._data.batch_cancel_ops = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + memcpy(&(self._ptr[0].batch_cancel_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) @property def batch_destroy_ops(self): - """: """ - return self._data.batch_destroy_ops + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_destroy_ops), self._readonly, self) @batch_destroy_ops.setter def batch_destroy_ops(self, val): - self._data.batch_destroy_ops = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + memcpy(&(self._ptr[0].batch_destroy_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) @property def batch_enqueued_ops(self): - """: """ - return self._data.batch_enqueued_ops + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_enqueued_ops), self._readonly, self) @batch_enqueued_ops.setter def batch_enqueued_ops(self, val): - self._data.batch_enqueued_ops = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + memcpy(&(self._ptr[0].batch_enqueued_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) @property def batch_posix_enqueued_ops(self): - """: """ - return self._data.batch_posix_enqueued_ops + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_posix_enqueued_ops), self._readonly, self) @batch_posix_enqueued_ops.setter def batch_posix_enqueued_ops(self, val): - self._data.batch_posix_enqueued_ops = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + memcpy(&(self._ptr[0].batch_posix_enqueued_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) @property def batch_processed_ops(self): - """: """ - return self._data.batch_processed_ops + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_processed_ops), self._readonly, self) @batch_processed_ops.setter def batch_processed_ops(self, val): - self._data.batch_processed_ops = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + memcpy(&(self._ptr[0].batch_processed_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) @property def batch_posix_processed_ops(self): - """: """ - return self._data.batch_posix_processed_ops + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_posix_processed_ops), self._readonly, self) @batch_posix_processed_ops.setter def batch_posix_processed_ops(self, val): - self._data.batch_posix_processed_ops = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + memcpy(&(self._ptr[0].batch_posix_processed_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) @property def batch_nvfs_submit_ops(self): - """: """ - return self._data.batch_nvfs_submit_ops + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_nvfs_submit_ops), self._readonly, self) @batch_nvfs_submit_ops.setter def batch_nvfs_submit_ops(self, val): - self._data.batch_nvfs_submit_ops = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + memcpy(&(self._ptr[0].batch_nvfs_submit_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) @property def batch_p2p_submit_ops(self): - """: """ - return self._data.batch_p2p_submit_ops + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_p2p_submit_ops), self._readonly, self) @batch_p2p_submit_ops.setter def batch_p2p_submit_ops(self, val): - self._data.batch_p2p_submit_ops = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + memcpy(&(self._ptr[0].batch_p2p_submit_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) @property def batch_aio_submit_ops(self): - """: """ - return self._data.batch_aio_submit_ops + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_aio_submit_ops), self._readonly, self) @batch_aio_submit_ops.setter def batch_aio_submit_ops(self, val): - self._data.batch_aio_submit_ops = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + memcpy(&(self._ptr[0].batch_aio_submit_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) @property def batch_iouring_submit_ops(self): - """: """ - return self._data.batch_iouring_submit_ops + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_iouring_submit_ops), self._readonly, self) @batch_iouring_submit_ops.setter def batch_iouring_submit_ops(self, val): - self._data.batch_iouring_submit_ops = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + memcpy(&(self._ptr[0].batch_iouring_submit_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) @property def batch_mixed_io_submit_ops(self): - """: """ - return self._data.batch_mixed_io_submit_ops + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_mixed_io_submit_ops), self._readonly, self) @batch_mixed_io_submit_ops.setter def batch_mixed_io_submit_ops(self, val): - self._data.batch_mixed_io_submit_ops = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + memcpy(&(self._ptr[0].batch_mixed_io_submit_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) @property def batch_total_submit_ops(self): - """: """ - return self._data.batch_total_submit_ops + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_total_submit_ops), self._readonly, self) @batch_total_submit_ops.setter def batch_total_submit_ops(self, val): - self._data.batch_total_submit_ops = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + memcpy(&(self._ptr[0].batch_total_submit_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def read_bytes(self): + """int: """ + return self._ptr[0].read_bytes + + @read_bytes.setter + def read_bytes(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].read_bytes = val + + @property + def write_bytes(self): + """int: """ + return self._ptr[0].write_bytes + + @write_bytes.setter + def write_bytes(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].write_bytes = val + + @property + def read_bw_bytes_per_sec(self): + """int: """ + return self._ptr[0].read_bw_bytes_per_sec + + @read_bw_bytes_per_sec.setter + def read_bw_bytes_per_sec(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].read_bw_bytes_per_sec = val + + @property + def write_bw_bytes_per_sec(self): + """int: """ + return self._ptr[0].write_bw_bytes_per_sec + + @write_bw_bytes_per_sec.setter + def write_bw_bytes_per_sec(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].write_bw_bytes_per_sec = val + + @property + def read_lat_avg_us(self): + """int: """ + return self._ptr[0].read_lat_avg_us + + @read_lat_avg_us.setter + def read_lat_avg_us(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].read_lat_avg_us = val + + @property + def write_lat_avg_us(self): + """int: """ + return self._ptr[0].write_lat_avg_us + + @write_lat_avg_us.setter + def write_lat_avg_us(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].write_lat_avg_us = val + + @property + def read_ops_per_sec(self): + """int: """ + return self._ptr[0].read_ops_per_sec + + @read_ops_per_sec.setter + def read_ops_per_sec(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].read_ops_per_sec = val + + @property + def write_ops_per_sec(self): + """int: """ + return self._ptr[0].write_ops_per_sec + + @write_ops_per_sec.setter + def write_ops_per_sec(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].write_ops_per_sec = val + + @property + def read_lat_sum_us(self): + """int: """ + return self._ptr[0].read_lat_sum_us + + @read_lat_sum_us.setter + def read_lat_sum_us(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].read_lat_sum_us = val + + @property + def write_lat_sum_us(self): + """int: """ + return self._ptr[0].write_lat_sum_us + + @write_lat_sum_us.setter + def write_lat_sum_us(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].write_lat_sum_us = val @property def batch_read_bytes(self): """int: """ - return int(self._data.batch_read_bytes[0]) + return self._ptr[0].batch_read_bytes @batch_read_bytes.setter def batch_read_bytes(self, val): - self._data.batch_read_bytes = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].batch_read_bytes = val @property def batch_write_bytes(self): """int: """ - return int(self._data.batch_write_bytes[0]) + return self._ptr[0].batch_write_bytes @batch_write_bytes.setter def batch_write_bytes(self, val): - self._data.batch_write_bytes = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].batch_write_bytes = val @property def batch_read_bw_bytes(self): """int: """ - return int(self._data.batch_read_bw_bytes[0]) + return self._ptr[0].batch_read_bw_bytes @batch_read_bw_bytes.setter def batch_read_bw_bytes(self, val): - self._data.batch_read_bw_bytes = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].batch_read_bw_bytes = val @property def batch_write_bw_bytes(self): """int: """ - return int(self._data.batch_write_bw_bytes[0]) + return self._ptr[0].batch_write_bw_bytes @batch_write_bw_bytes.setter def batch_write_bw_bytes(self, val): - self._data.batch_write_bw_bytes = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].batch_write_bw_bytes = val @property def batch_submit_lat_avg_us(self): """int: """ - return int(self._data.batch_submit_lat_avg_us[0]) + return self._ptr[0].batch_submit_lat_avg_us @batch_submit_lat_avg_us.setter def batch_submit_lat_avg_us(self, val): - self._data.batch_submit_lat_avg_us = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].batch_submit_lat_avg_us = val @property def batch_completion_lat_avg_us(self): """int: """ - return int(self._data.batch_completion_lat_avg_us[0]) + return self._ptr[0].batch_completion_lat_avg_us @batch_completion_lat_avg_us.setter def batch_completion_lat_avg_us(self, val): - self._data.batch_completion_lat_avg_us = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].batch_completion_lat_avg_us = val @property def batch_submit_ops_per_sec(self): """int: """ - return int(self._data.batch_submit_ops_per_sec[0]) + return self._ptr[0].batch_submit_ops_per_sec @batch_submit_ops_per_sec.setter def batch_submit_ops_per_sec(self, val): - self._data.batch_submit_ops_per_sec = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].batch_submit_ops_per_sec = val @property def batch_complete_ops_per_sec(self): """int: """ - return int(self._data.batch_complete_ops_per_sec[0]) + return self._ptr[0].batch_complete_ops_per_sec @batch_complete_ops_per_sec.setter def batch_complete_ops_per_sec(self, val): - self._data.batch_complete_ops_per_sec = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].batch_complete_ops_per_sec = val @property def batch_submit_lat_sum_us(self): """int: """ - return int(self._data.batch_submit_lat_sum_us[0]) + return self._ptr[0].batch_submit_lat_sum_us @batch_submit_lat_sum_us.setter def batch_submit_lat_sum_us(self, val): - self._data.batch_submit_lat_sum_us = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].batch_submit_lat_sum_us = val @property def batch_completion_lat_sum_us(self): """int: """ - return int(self._data.batch_completion_lat_sum_us[0]) + return self._ptr[0].batch_completion_lat_sum_us @batch_completion_lat_sum_us.setter def batch_completion_lat_sum_us(self, val): - self._data.batch_completion_lat_sum_us = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].batch_completion_lat_sum_us = val @property def last_batch_read_bytes(self): """int: """ - return int(self._data.last_batch_read_bytes[0]) + return self._ptr[0].last_batch_read_bytes @last_batch_read_bytes.setter def last_batch_read_bytes(self, val): - self._data.last_batch_read_bytes = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].last_batch_read_bytes = val @property def last_batch_write_bytes(self): """int: """ - return int(self._data.last_batch_write_bytes[0]) + return self._ptr[0].last_batch_write_bytes @last_batch_write_bytes.setter def last_batch_write_bytes(self, val): - self._data.last_batch_write_bytes = val - - def __setitem__(self, key, val): - self._data[key] = val + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].last_batch_write_bytes = val @staticmethod def from_data(data): """Create an StatsLevel1 instance wrapping the given NumPy array. Args: - data (_numpy.ndarray): a 1D array of dtype `stats_level1_dtype` holding the data. + data (_numpy.ndarray): a single-element array of dtype `stats_level1_dtype` holding the data. """ - cdef StatsLevel1 obj = StatsLevel1.__new__(StatsLevel1) - if not isinstance(data, (_numpy.ndarray, _numpy.recarray)): - raise TypeError("data argument must be a NumPy ndarray") - if data.ndim != 1: - raise ValueError("data array must be 1D") - if data.dtype != stats_level1_dtype: - raise ValueError("data array must be of dtype stats_level1_dtype") - obj._data = data.view(_numpy.recarray) - - return obj + return __from_data(data, "stats_level1_dtype", stats_level1_dtype, StatsLevel1.from_ptr) @staticmethod - def from_ptr(intptr_t ptr, bint readonly=False): + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an StatsLevel1 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 StatsLevel1 obj = StatsLevel1.__new__(StatsLevel1) - cdef flag = _buffer.PyBUF_READ if readonly else _buffer.PyBUF_WRITE - cdef object buf = PyMemoryView_FromMemory( - ptr, sizeof(CUfileStatsLevel1_t), flag) - data = _numpy.ndarray((1,), buffer=buf, - dtype=stats_level1_dtype) - obj._data = data.view(_numpy.recarray) - + if owner is None: + obj._ptr = malloc(sizeof(CUfileStatsLevel1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating StatsLevel1") + memcpy((obj._ptr), ptr, sizeof(CUfileStatsLevel1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly return obj @@ -1683,11 +1947,15 @@ cdef class IOParams: cdef: readonly object _data + readonly tuple _u + + + def __init__(self, size=1): arr = _numpy.empty(size, dtype=io_params_dtype) self._data = arr.view(_numpy.recarray) assert self._data.itemsize == sizeof(CUfileIOParams_t), \ - f"itemsize {self._data.itemsize} mismatches struct size {sizeof(CUfileIOParams_t)}" + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(CUfileIOParams_t) }" def __repr__(self): if self._data.size > 1: @@ -1701,7 +1969,6 @@ cdef class IOParams: return self._data.ctypes.data cdef intptr_t _get_ptr(self): - """Get the pointer address to the data as Python :class:`int`.""" return self._data.ctypes.data def __int__(self): @@ -1714,13 +1981,17 @@ cdef class IOParams: return self._data.size def __eq__(self, other): - if not isinstance(other, IOParams): - return False - if self._data.size != other._data.size: + cdef object self_data = self._data + if (not isinstance(other, IOParams)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: return False - if self._data.dtype != other._data.dtype: - return False - return bool((self._data == other._data).all()) + return bool((self_data == other._data).all()) + + @property + def u(self): + """_py_anon_pod2: """ + if self._data.size == 1: + return self._u[0] + return self._u @property def mode(self): @@ -1733,15 +2004,6 @@ cdef class IOParams: def mode(self, val): self._data.mode = val - @property - def u(self): - """_py_anon_pod2_dtype: """ - return self._data.u - - @u.setter - def u(self, val): - self._data.u = val - @property def fh(self): """Union[~_numpy.intp, int]: """ @@ -1776,13 +2038,16 @@ cdef class IOParams: self._data.cookie = val def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size if isinstance(key, int): + key_ = key size = self._data.size - if key >= size or key <= -(size+1): + if key_ >= size or key_ <= -(size+1): raise IndexError("index is out of bounds") - if key < 0: - key += size - return IOParams.from_data(self._data[key:key+1]) + if key_ < 0: + key_ += size + return IOParams.from_data(self._data[key_:key_+1]) out = self._data[key] if isinstance(out, _numpy.recarray) and out.dtype == io_params_dtype: return IOParams.from_data(out) @@ -1799,7 +2064,7 @@ cdef class IOParams: data (_numpy.ndarray): a 1D array of dtype `io_params_dtype` holding the data. """ cdef IOParams obj = IOParams.__new__(IOParams) - if not isinstance(data, (_numpy.ndarray, _numpy.recarray)): + 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") @@ -1807,6 +2072,13 @@ cdef class IOParams: raise ValueError("data array must be of dtype io_params_dtype") obj._data = data.view(_numpy.recarray) + u_list = list() + for i in range(obj._data.size): + addr = obj._data.u[i].__array_interface__['data'][0] + _py_anon_pod2_obj = _py_anon_pod2.from_ptr(addr, owner=obj) + u_list.append(_py_anon_pod2_obj) + + obj._u = tuple(u_list) return obj @staticmethod @@ -1821,13 +2093,19 @@ cdef class IOParams: if ptr == 0: raise ValueError("ptr must not be null (0)") cdef IOParams obj = IOParams.__new__(IOParams) - cdef flag = _buffer.PyBUF_READ if readonly else _buffer.PyBUF_WRITE - cdef object buf = PyMemoryView_FromMemory( + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( ptr, sizeof(CUfileIOParams_t) * size, flag) - data = _numpy.ndarray((size,), buffer=buf, - dtype=io_params_dtype) + data = _numpy.ndarray(size, buffer=buf, dtype=io_params_dtype) obj._data = data.view(_numpy.recarray) + u_list = list() + for i in range(obj._data.size): + addr = obj._data.u[i].__array_interface__['data'][0] + _py_anon_pod2_obj = _py_anon_pod2.from_ptr(addr, owner=obj) + u_list.append(_py_anon_pod2_obj) + + obj._u = tuple(u_list) return obj @@ -1845,13 +2123,20 @@ cdef class StatsLevel2: .. seealso:: `CUfileStatsLevel2_t` """ cdef: - readonly object _data + CUfileStatsLevel2_t *_ptr + object _owner + bint _readonly def __init__(self): - arr = _numpy.empty(1, dtype=stats_level2_dtype) - self._data = arr.view(_numpy.recarray) - assert self._data.itemsize == sizeof(CUfileStatsLevel2_t), \ - f"itemsize {self._data.itemsize} mismatches struct size {sizeof(CUfileStatsLevel2_t)}" + self._ptr = calloc(1, sizeof(CUfileStatsLevel2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating StatsLevel2") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) def __repr__(self): return f"<{__name__}.StatsLevel2 object at {hex(id(self))}>" @@ -1859,90 +2144,105 @@ cdef class StatsLevel2: @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" - return self._data.ctypes.data + return (self._ptr) cdef intptr_t _get_ptr(self): - """Get the pointer address to the data as Python :class:`int`.""" - return self._data.ctypes.data + return (self._ptr) def __int__(self): - return self._data.ctypes.data + return (self._ptr) def __eq__(self, other): + cdef StatsLevel2 other_ if not isinstance(other, StatsLevel2): return False - if self._data.size != other._data.size: - return False - if self._data.dtype != other._data.dtype: - return False - return bool((self._data == other._data).all()) + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof(CUfileStatsLevel2_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(CUfileStatsLevel2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating StatsLevel2") + memcpy(self._ptr, val.ctypes.data, sizeof(CUfileStatsLevel2_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) @property def basic(self): - """: """ - return self._data.basic + """StatsLevel1: """ + return StatsLevel1.from_ptr(&(self._ptr[0].basic), self._readonly, self) @basic.setter def basic(self, val): - self._data.basic = val + if self._readonly: + raise ValueError("This StatsLevel2 instance is read-only") + cdef StatsLevel1 val_ = val + memcpy(&(self._ptr[0].basic), (val_._get_ptr()), sizeof(CUfileStatsLevel1_t) * 1) @property def read_size_kb_hist(self): """~_numpy.uint64: (array of length 32).""" - return self._data.read_size_kb_hist + cdef view.array arr = view.array(shape=(32,), itemsize=sizeof(uint64_t), format="Q", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].read_size_kb_hist)) + return arr @read_size_kb_hist.setter def read_size_kb_hist(self, val): - self._data.read_size_kb_hist = val + if self._readonly: + raise ValueError("This StatsLevel2 instance is read-only") + cdef view.array arr = view.array(shape=(32,), itemsize=sizeof(uint64_t), format="Q", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint64) + memcpy((&(self._ptr[0].read_size_kb_hist)), (arr.data), sizeof(uint64_t) * len(val)) @property def write_size_kb_hist(self): """~_numpy.uint64: (array of length 32).""" - return self._data.write_size_kb_hist + cdef view.array arr = view.array(shape=(32,), itemsize=sizeof(uint64_t), format="Q", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].write_size_kb_hist)) + return arr @write_size_kb_hist.setter def write_size_kb_hist(self, val): - self._data.write_size_kb_hist = val - - def __setitem__(self, key, val): - self._data[key] = val + if self._readonly: + raise ValueError("This StatsLevel2 instance is read-only") + cdef view.array arr = view.array(shape=(32,), itemsize=sizeof(uint64_t), format="Q", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint64) + memcpy((&(self._ptr[0].write_size_kb_hist)), (arr.data), sizeof(uint64_t) * len(val)) @staticmethod def from_data(data): """Create an StatsLevel2 instance wrapping the given NumPy array. Args: - data (_numpy.ndarray): a 1D array of dtype `stats_level2_dtype` holding the data. + data (_numpy.ndarray): a single-element array of dtype `stats_level2_dtype` holding the data. """ - cdef StatsLevel2 obj = StatsLevel2.__new__(StatsLevel2) - if not isinstance(data, (_numpy.ndarray, _numpy.recarray)): - raise TypeError("data argument must be a NumPy ndarray") - if data.ndim != 1: - raise ValueError("data array must be 1D") - if data.dtype != stats_level2_dtype: - raise ValueError("data array must be of dtype stats_level2_dtype") - obj._data = data.view(_numpy.recarray) - - return obj + return __from_data(data, "stats_level2_dtype", stats_level2_dtype, StatsLevel2.from_ptr) @staticmethod - def from_ptr(intptr_t ptr, bint readonly=False): + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an StatsLevel2 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 StatsLevel2 obj = StatsLevel2.__new__(StatsLevel2) - cdef flag = _buffer.PyBUF_READ if readonly else _buffer.PyBUF_WRITE - cdef object buf = PyMemoryView_FromMemory( - ptr, sizeof(CUfileStatsLevel2_t), flag) - data = _numpy.ndarray((1,), buffer=buf, - dtype=stats_level2_dtype) - obj._data = data.view(_numpy.recarray) - + if owner is None: + obj._ptr = malloc(sizeof(CUfileStatsLevel2_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating StatsLevel2") + memcpy((obj._ptr), ptr, sizeof(CUfileStatsLevel2_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly return obj @@ -1960,13 +2260,20 @@ cdef class StatsLevel3: .. seealso:: `CUfileStatsLevel3_t` """ cdef: - readonly object _data + CUfileStatsLevel3_t *_ptr + object _owner + bint _readonly def __init__(self): - arr = _numpy.empty(1, dtype=stats_level3_dtype) - self._data = arr.view(_numpy.recarray) - assert self._data.itemsize == sizeof(CUfileStatsLevel3_t), \ - f"itemsize {self._data.itemsize} mismatches struct size {sizeof(CUfileStatsLevel3_t)}" + self._ptr = calloc(1, sizeof(CUfileStatsLevel3_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating StatsLevel3") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) def __repr__(self): return f"<{__name__}.StatsLevel3 object at {hex(id(self))}>" @@ -1974,90 +2281,100 @@ cdef class StatsLevel3: @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" - return self._data.ctypes.data + return (self._ptr) cdef intptr_t _get_ptr(self): - """Get the pointer address to the data as Python :class:`int`.""" - return self._data.ctypes.data + return (self._ptr) def __int__(self): - return self._data.ctypes.data + return (self._ptr) def __eq__(self, other): + cdef StatsLevel3 other_ if not isinstance(other, StatsLevel3): return False - if self._data.size != other._data.size: - return False - if self._data.dtype != other._data.dtype: - return False - return bool((self._data == other._data).all()) + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof(CUfileStatsLevel3_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(CUfileStatsLevel3_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating StatsLevel3") + memcpy(self._ptr, val.ctypes.data, sizeof(CUfileStatsLevel3_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) @property def detailed(self): - """: """ - return self._data.detailed + """StatsLevel2: """ + return StatsLevel2.from_ptr(&(self._ptr[0].detailed), self._readonly, self) @detailed.setter def detailed(self, val): - self._data.detailed = val - - @property - def num_gpus(self): - """int: """ - return int(self._data.num_gpus[0]) - - @num_gpus.setter - def num_gpus(self, val): - self._data.num_gpus = val + if self._readonly: + raise ValueError("This StatsLevel3 instance is read-only") + cdef StatsLevel2 val_ = val + memcpy(&(self._ptr[0].detailed), (val_._get_ptr()), sizeof(CUfileStatsLevel2_t) * 1) @property def per_gpu_stats(self): - """per_gpu_stats_dtype: (array of length 16).""" - return self._data.per_gpu_stats + """PerGpuStats: """ + return PerGpuStats.from_ptr(&(self._ptr[0].per_gpu_stats), 16, self._readonly) @per_gpu_stats.setter def per_gpu_stats(self, val): - self._data.per_gpu_stats = val + if self._readonly: + raise ValueError("This StatsLevel3 instance is read-only") + cdef PerGpuStats val_ = val + if len(val) != 16: + raise ValueError(f"Expected length 16 for field per_gpu_stats, got {len(val)}") + memcpy(&(self._ptr[0].per_gpu_stats), (val_._get_ptr()), sizeof(CUfilePerGpuStats_t) * 16) - def __setitem__(self, key, val): - self._data[key] = val + @property + def num_gpus(self): + """int: """ + return self._ptr[0].num_gpus + + @num_gpus.setter + def num_gpus(self, val): + if self._readonly: + raise ValueError("This StatsLevel3 instance is read-only") + self._ptr[0].num_gpus = val @staticmethod def from_data(data): """Create an StatsLevel3 instance wrapping the given NumPy array. Args: - data (_numpy.ndarray): a 1D array of dtype `stats_level3_dtype` holding the data. + data (_numpy.ndarray): a single-element array of dtype `stats_level3_dtype` holding the data. """ - cdef StatsLevel3 obj = StatsLevel3.__new__(StatsLevel3) - if not isinstance(data, (_numpy.ndarray, _numpy.recarray)): - raise TypeError("data argument must be a NumPy ndarray") - if data.ndim != 1: - raise ValueError("data array must be 1D") - if data.dtype != stats_level3_dtype: - raise ValueError("data array must be of dtype stats_level3_dtype") - obj._data = data.view(_numpy.recarray) - - return obj + return __from_data(data, "stats_level3_dtype", stats_level3_dtype, StatsLevel3.from_ptr) @staticmethod - def from_ptr(intptr_t ptr, bint readonly=False): + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an StatsLevel3 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 StatsLevel3 obj = StatsLevel3.__new__(StatsLevel3) - cdef flag = _buffer.PyBUF_READ if readonly else _buffer.PyBUF_WRITE - cdef object buf = PyMemoryView_FromMemory( - ptr, sizeof(CUfileStatsLevel3_t), flag) - data = _numpy.ndarray((1,), buffer=buf, - dtype=stats_level3_dtype) - obj._data = data.view(_numpy.recarray) - + if owner is None: + obj._ptr = malloc(sizeof(CUfileStatsLevel3_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating StatsLevel3") + memcpy((obj._ptr), ptr, sizeof(CUfileStatsLevel3_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly return obj diff --git a/cuda_bindings/cuda/bindings/cycufile.pxd b/cuda_bindings/cuda/bindings/cycufile.pxd index c57b18b95d..aa8ea93d48 100644 --- a/cuda_bindings/cuda/bindings/cycufile.pxd +++ b/cuda_bindings/cuda/bindings/cycufile.pxd @@ -30,8 +30,10 @@ cdef extern from "": ctypedef sockaddr sockaddr_t -cdef extern from '': + + # enums +cdef extern from '': ctypedef enum CUfileOpError: CU_FILE_SUCCESS CU_FILE_DRIVER_NOT_INITIALIZED @@ -83,6 +85,7 @@ cdef extern from '': CU_FILE_BATCH_NOCOMPAT_ERROR CU_FILE_IO_MAX_ERROR +cdef extern from '': ctypedef enum CUfileDriverStatusFlags_t: CU_FILE_LUSTRE_SUPPORTED CU_FILE_WEKAFS_SUPPORTED @@ -97,25 +100,30 @@ cdef extern from '': CU_FILE_NVME_P2P_SUPPORTED CU_FILE_SCATEFS_SUPPORTED +cdef extern from '': ctypedef enum CUfileDriverControlFlags_t: CU_FILE_USE_POLL_MODE CU_FILE_ALLOW_COMPAT_MODE +cdef extern from '': ctypedef enum CUfileFeatureFlags_t: CU_FILE_DYN_ROUTING_SUPPORTED CU_FILE_BATCH_IO_SUPPORTED CU_FILE_STREAMS_SUPPORTED CU_FILE_PARALLEL_IO_SUPPORTED +cdef extern from '': ctypedef enum CUfileFileHandleType: CU_FILE_HANDLE_TYPE_OPAQUE_FD CU_FILE_HANDLE_TYPE_OPAQUE_WIN32 CU_FILE_HANDLE_TYPE_USERSPACE_FS +cdef extern from '': ctypedef enum CUfileOpcode_t: CUFILE_READ CUFILE_WRITE +cdef extern from '': ctypedef enum CUfileStatus_t: CUFILE_WAITING CUFILE_PENDING @@ -125,9 +133,11 @@ cdef extern from '': CUFILE_TIMEOUT CUFILE_FAILED +cdef extern from '': ctypedef enum CUfileBatchMode_t: CUFILE_BATCH +cdef extern from '': ctypedef enum CUFileSizeTConfigParameter_t: CUFILE_PARAM_PROFILE_STATS CUFILE_PARAM_EXECUTION_MAX_IO_QUEUE_DEPTH @@ -142,6 +152,7 @@ cdef extern from '': CUFILE_PARAM_POLLTHRESHOLD_SIZE_KB CUFILE_PARAM_PROPERTIES_BATCH_IO_TIMEOUT_MS +cdef extern from '': ctypedef enum CUFileBoolConfigParameter_t: CUFILE_PARAM_PROPERTIES_USE_POLL_MODE CUFILE_PARAM_PROPERTIES_ALLOW_COMPAT_MODE @@ -156,53 +167,73 @@ cdef extern from '': CUFILE_PARAM_SKIP_TOPOLOGY_DETECTION CUFILE_PARAM_STREAM_MEMOPS_BYPASS +cdef extern from '': ctypedef enum CUFileStringConfigParameter_t: CUFILE_PARAM_LOGGING_LEVEL CUFILE_PARAM_ENV_LOGFILE_PATH CUFILE_PARAM_LOG_DIR +cdef extern from '': ctypedef enum CUFileArrayConfigParameter_t: CUFILE_PARAM_POSIX_POOL_SLAB_SIZE_KB CUFILE_PARAM_POSIX_POOL_SLAB_COUNT # types +cdef extern from '': ctypedef void* CUfileHandle_t 'CUfileHandle_t' + +cdef extern from '': ctypedef void* CUfileBatchHandle_t 'CUfileBatchHandle_t' + +cdef extern from '': ctypedef struct CUfileError_t 'CUfileError_t': CUfileOpError err CUresult cu_err - cdef struct _anon_pod0 '_anon_pod0': - unsigned int major_version - unsigned int minor_version - size_t poll_thresh_size - size_t max_direct_io_size - unsigned int dstatusflags - unsigned int dcontrolflags + +cdef struct _anon_pod0 '_anon_pod0': + unsigned int major_version + unsigned int minor_version + size_t poll_thresh_size + size_t max_direct_io_size + unsigned int dstatusflags + unsigned int dcontrolflags + +cdef extern from '': ctypedef struct cufileRDMAInfo_t 'cufileRDMAInfo_t': int version int desc_len char* desc_str + +cdef extern from '': ctypedef struct CUfileFSOps_t 'CUfileFSOps_t': char* (*fs_type)(void*) int (*getRDMADeviceList)(void*, sockaddr_t**) int (*getRDMADevicePriority)(void*, char*, size_t, loff_t, sockaddr_t*) ssize_t (*read)(void*, char*, size_t, loff_t, cufileRDMAInfo_t*) ssize_t (*write)(void*, const char*, size_t, loff_t, cufileRDMAInfo_t*) - cdef union _anon_pod1 '_anon_pod1': - int fd - void* handle - cdef struct _anon_pod3 '_anon_pod3': - void* devPtr_base - off_t file_offset - off_t devPtr_offset - size_t size + +cdef union _anon_pod1 '_anon_pod1': + int fd + void* handle + +cdef struct _anon_pod3 '_anon_pod3': + void* devPtr_base + off_t file_offset + off_t devPtr_offset + size_t size + +cdef extern from '': ctypedef struct CUfileIOEvents_t 'CUfileIOEvents_t': void* cookie CUfileStatus_t status size_t ret + +cdef extern from '': ctypedef struct CUfileOpCounter_t 'CUfileOpCounter_t': uint64_t ok uint64_t err + +cdef extern from '': ctypedef struct CUfilePerGpuStats_t 'CUfilePerGpuStats_t': char uuid[16] uint64_t read_bytes @@ -234,6 +265,8 @@ cdef extern from '': uint64_t n_mmap_err uint64_t n_mmap_free uint64_t reg_bytes + +cdef extern from '': ctypedef struct CUfileDrvProps_t 'CUfileDrvProps_t': _anon_pod0 nvfs unsigned int fflags @@ -242,12 +275,17 @@ cdef extern from '': unsigned int max_device_pinned_mem_size unsigned int max_batch_io_size unsigned int max_batch_io_timeout_msecs + +cdef extern from '': ctypedef struct CUfileDescr_t 'CUfileDescr_t': CUfileFileHandleType type _anon_pod1 handle CUfileFSOps_t* fs_ops - cdef union _anon_pod2 '_anon_pod2': - _anon_pod3 batch + +cdef union _anon_pod2 '_anon_pod2': + _anon_pod3 batch + +cdef extern from '': ctypedef struct CUfileStatsLevel1_t 'CUfileStatsLevel1_t': CUfileOpCounter_t read_ops CUfileOpCounter_t write_ops @@ -292,22 +330,29 @@ cdef extern from '': uint64_t batch_completion_lat_sum_us uint64_t last_batch_read_bytes uint64_t last_batch_write_bytes + +cdef extern from '': ctypedef struct CUfileIOParams_t 'CUfileIOParams_t': CUfileBatchMode_t mode _anon_pod2 u CUfileHandle_t fh CUfileOpcode_t opcode void* cookie + +cdef extern from '': ctypedef struct CUfileStatsLevel2_t 'CUfileStatsLevel2_t': CUfileStatsLevel1_t basic uint64_t read_size_kb_hist[32] uint64_t write_size_kb_hist[32] + +cdef extern from '': ctypedef struct CUfileStatsLevel3_t 'CUfileStatsLevel3_t': CUfileStatsLevel2_t detailed uint32_t num_gpus CUfilePerGpuStats_t per_gpu_stats[16] + cdef extern from *: """ // This is the missing piece we need to supply to help Cython & C++ compilers. diff --git a/cuda_bindings/cuda/bindings/cynvml.pxd b/cuda_bindings/cuda/bindings/cynvml.pxd new file mode 100644 index 0000000000..de910fe6d6 --- /dev/null +++ b/cuda_bindings/cuda/bindings/cynvml.pxd @@ -0,0 +1,2039 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE +# +# This code was automatically generated across versions from 12.9.1 to 13.0.1. Do not modify it directly. + +from libc.stdint cimport int64_t + + +############################################################################### +# Types (structs, enums, ...) +############################################################################### + +# enums +ctypedef enum nvmlBridgeChipType_t "nvmlBridgeChipType_t": + NVML_BRIDGE_CHIP_PLX "NVML_BRIDGE_CHIP_PLX" = 0 + NVML_BRIDGE_CHIP_BRO4 "NVML_BRIDGE_CHIP_BRO4" = 1 + +ctypedef enum nvmlNvLinkUtilizationCountUnits_t "nvmlNvLinkUtilizationCountUnits_t": + NVML_NVLINK_COUNTER_UNIT_CYCLES "NVML_NVLINK_COUNTER_UNIT_CYCLES" = 0 + NVML_NVLINK_COUNTER_UNIT_PACKETS "NVML_NVLINK_COUNTER_UNIT_PACKETS" = 1 + NVML_NVLINK_COUNTER_UNIT_BYTES "NVML_NVLINK_COUNTER_UNIT_BYTES" = 2 + NVML_NVLINK_COUNTER_UNIT_RESERVED "NVML_NVLINK_COUNTER_UNIT_RESERVED" = 3 + NVML_NVLINK_COUNTER_UNIT_COUNT "NVML_NVLINK_COUNTER_UNIT_COUNT" + +ctypedef enum nvmlNvLinkUtilizationCountPktTypes_t "nvmlNvLinkUtilizationCountPktTypes_t": + NVML_NVLINK_COUNTER_PKTFILTER_NOP "NVML_NVLINK_COUNTER_PKTFILTER_NOP" = 0x1 + NVML_NVLINK_COUNTER_PKTFILTER_READ "NVML_NVLINK_COUNTER_PKTFILTER_READ" = 0x2 + NVML_NVLINK_COUNTER_PKTFILTER_WRITE "NVML_NVLINK_COUNTER_PKTFILTER_WRITE" = 0x4 + NVML_NVLINK_COUNTER_PKTFILTER_RATOM "NVML_NVLINK_COUNTER_PKTFILTER_RATOM" = 0x8 + NVML_NVLINK_COUNTER_PKTFILTER_NRATOM "NVML_NVLINK_COUNTER_PKTFILTER_NRATOM" = 0x10 + NVML_NVLINK_COUNTER_PKTFILTER_FLUSH "NVML_NVLINK_COUNTER_PKTFILTER_FLUSH" = 0x20 + NVML_NVLINK_COUNTER_PKTFILTER_RESPDATA "NVML_NVLINK_COUNTER_PKTFILTER_RESPDATA" = 0x40 + NVML_NVLINK_COUNTER_PKTFILTER_RESPNODATA "NVML_NVLINK_COUNTER_PKTFILTER_RESPNODATA" = 0x80 + NVML_NVLINK_COUNTER_PKTFILTER_ALL "NVML_NVLINK_COUNTER_PKTFILTER_ALL" = 0xFF + +ctypedef enum nvmlNvLinkCapability_t "nvmlNvLinkCapability_t": + NVML_NVLINK_CAP_P2P_SUPPORTED "NVML_NVLINK_CAP_P2P_SUPPORTED" = 0 + NVML_NVLINK_CAP_SYSMEM_ACCESS "NVML_NVLINK_CAP_SYSMEM_ACCESS" = 1 + NVML_NVLINK_CAP_P2P_ATOMICS "NVML_NVLINK_CAP_P2P_ATOMICS" = 2 + NVML_NVLINK_CAP_SYSMEM_ATOMICS "NVML_NVLINK_CAP_SYSMEM_ATOMICS" = 3 + NVML_NVLINK_CAP_SLI_BRIDGE "NVML_NVLINK_CAP_SLI_BRIDGE" = 4 + NVML_NVLINK_CAP_VALID "NVML_NVLINK_CAP_VALID" = 5 + NVML_NVLINK_CAP_COUNT "NVML_NVLINK_CAP_COUNT" + +ctypedef enum nvmlNvLinkErrorCounter_t "nvmlNvLinkErrorCounter_t": + NVML_NVLINK_ERROR_DL_REPLAY "NVML_NVLINK_ERROR_DL_REPLAY" = 0 + NVML_NVLINK_ERROR_DL_RECOVERY "NVML_NVLINK_ERROR_DL_RECOVERY" = 1 + NVML_NVLINK_ERROR_DL_CRC_FLIT "NVML_NVLINK_ERROR_DL_CRC_FLIT" = 2 + NVML_NVLINK_ERROR_DL_CRC_DATA "NVML_NVLINK_ERROR_DL_CRC_DATA" = 3 + NVML_NVLINK_ERROR_DL_ECC_DATA "NVML_NVLINK_ERROR_DL_ECC_DATA" = 4 + NVML_NVLINK_ERROR_COUNT "NVML_NVLINK_ERROR_COUNT" + +ctypedef enum nvmlIntNvLinkDeviceType_t "nvmlIntNvLinkDeviceType_t": + NVML_NVLINK_DEVICE_TYPE_GPU "NVML_NVLINK_DEVICE_TYPE_GPU" = 0x00 + NVML_NVLINK_DEVICE_TYPE_IBMNPU "NVML_NVLINK_DEVICE_TYPE_IBMNPU" = 0x01 + NVML_NVLINK_DEVICE_TYPE_SWITCH "NVML_NVLINK_DEVICE_TYPE_SWITCH" = 0x02 + NVML_NVLINK_DEVICE_TYPE_UNKNOWN "NVML_NVLINK_DEVICE_TYPE_UNKNOWN" = 0xFF + +ctypedef enum nvmlGpuTopologyLevel_t "nvmlGpuTopologyLevel_t": + NVML_TOPOLOGY_INTERNAL "NVML_TOPOLOGY_INTERNAL" = 0 + NVML_TOPOLOGY_SINGLE "NVML_TOPOLOGY_SINGLE" = 10 + NVML_TOPOLOGY_MULTIPLE "NVML_TOPOLOGY_MULTIPLE" = 20 + NVML_TOPOLOGY_HOSTBRIDGE "NVML_TOPOLOGY_HOSTBRIDGE" = 30 + NVML_TOPOLOGY_NODE "NVML_TOPOLOGY_NODE" = 40 + NVML_TOPOLOGY_SYSTEM "NVML_TOPOLOGY_SYSTEM" = 50 + +ctypedef enum nvmlGpuP2PStatus_t "nvmlGpuP2PStatus_t": + NVML_P2P_STATUS_OK "NVML_P2P_STATUS_OK" = 0 + NVML_P2P_STATUS_CHIPSET_NOT_SUPPORED "NVML_P2P_STATUS_CHIPSET_NOT_SUPPORED" + NVML_P2P_STATUS_CHIPSET_NOT_SUPPORTED "NVML_P2P_STATUS_CHIPSET_NOT_SUPPORTED" = NVML_P2P_STATUS_CHIPSET_NOT_SUPPORED + NVML_P2P_STATUS_GPU_NOT_SUPPORTED "NVML_P2P_STATUS_GPU_NOT_SUPPORTED" + NVML_P2P_STATUS_IOH_TOPOLOGY_NOT_SUPPORTED "NVML_P2P_STATUS_IOH_TOPOLOGY_NOT_SUPPORTED" + NVML_P2P_STATUS_DISABLED_BY_REGKEY "NVML_P2P_STATUS_DISABLED_BY_REGKEY" + NVML_P2P_STATUS_NOT_SUPPORTED "NVML_P2P_STATUS_NOT_SUPPORTED" + NVML_P2P_STATUS_UNKNOWN "NVML_P2P_STATUS_UNKNOWN" + +ctypedef enum nvmlGpuP2PCapsIndex_t "nvmlGpuP2PCapsIndex_t": + NVML_P2P_CAPS_INDEX_READ "NVML_P2P_CAPS_INDEX_READ" = 0 + NVML_P2P_CAPS_INDEX_WRITE "NVML_P2P_CAPS_INDEX_WRITE" = 1 + NVML_P2P_CAPS_INDEX_NVLINK "NVML_P2P_CAPS_INDEX_NVLINK" = 2 + NVML_P2P_CAPS_INDEX_ATOMICS "NVML_P2P_CAPS_INDEX_ATOMICS" = 3 + NVML_P2P_CAPS_INDEX_PCI "NVML_P2P_CAPS_INDEX_PCI" = 4 + NVML_P2P_CAPS_INDEX_PROP "NVML_P2P_CAPS_INDEX_PROP" = NVML_P2P_CAPS_INDEX_PCI + NVML_P2P_CAPS_INDEX_UNKNOWN "NVML_P2P_CAPS_INDEX_UNKNOWN" = 5 + +ctypedef enum nvmlSamplingType_t "nvmlSamplingType_t": + NVML_TOTAL_POWER_SAMPLES "NVML_TOTAL_POWER_SAMPLES" = 0 + NVML_GPU_UTILIZATION_SAMPLES "NVML_GPU_UTILIZATION_SAMPLES" = 1 + NVML_MEMORY_UTILIZATION_SAMPLES "NVML_MEMORY_UTILIZATION_SAMPLES" = 2 + NVML_ENC_UTILIZATION_SAMPLES "NVML_ENC_UTILIZATION_SAMPLES" = 3 + NVML_DEC_UTILIZATION_SAMPLES "NVML_DEC_UTILIZATION_SAMPLES" = 4 + NVML_PROCESSOR_CLK_SAMPLES "NVML_PROCESSOR_CLK_SAMPLES" = 5 + NVML_MEMORY_CLK_SAMPLES "NVML_MEMORY_CLK_SAMPLES" = 6 + NVML_MODULE_POWER_SAMPLES "NVML_MODULE_POWER_SAMPLES" = 7 + NVML_JPG_UTILIZATION_SAMPLES "NVML_JPG_UTILIZATION_SAMPLES" = 8 + NVML_OFA_UTILIZATION_SAMPLES "NVML_OFA_UTILIZATION_SAMPLES" = 9 + NVML_SAMPLINGTYPE_COUNT "NVML_SAMPLINGTYPE_COUNT" + +ctypedef enum nvmlPcieUtilCounter_t "nvmlPcieUtilCounter_t": + NVML_PCIE_UTIL_TX_BYTES "NVML_PCIE_UTIL_TX_BYTES" = 0 + NVML_PCIE_UTIL_RX_BYTES "NVML_PCIE_UTIL_RX_BYTES" = 1 + NVML_PCIE_UTIL_COUNT "NVML_PCIE_UTIL_COUNT" + +ctypedef enum nvmlValueType_t "nvmlValueType_t": + NVML_VALUE_TYPE_DOUBLE "NVML_VALUE_TYPE_DOUBLE" = 0 + NVML_VALUE_TYPE_UNSIGNED_INT "NVML_VALUE_TYPE_UNSIGNED_INT" = 1 + NVML_VALUE_TYPE_UNSIGNED_LONG "NVML_VALUE_TYPE_UNSIGNED_LONG" = 2 + NVML_VALUE_TYPE_UNSIGNED_LONG_LONG "NVML_VALUE_TYPE_UNSIGNED_LONG_LONG" = 3 + NVML_VALUE_TYPE_SIGNED_LONG_LONG "NVML_VALUE_TYPE_SIGNED_LONG_LONG" = 4 + NVML_VALUE_TYPE_SIGNED_INT "NVML_VALUE_TYPE_SIGNED_INT" = 5 + NVML_VALUE_TYPE_UNSIGNED_SHORT "NVML_VALUE_TYPE_UNSIGNED_SHORT" = 6 + NVML_VALUE_TYPE_COUNT "NVML_VALUE_TYPE_COUNT" + +ctypedef enum nvmlPerfPolicyType_t "nvmlPerfPolicyType_t": + NVML_PERF_POLICY_POWER "NVML_PERF_POLICY_POWER" = 0 + NVML_PERF_POLICY_THERMAL "NVML_PERF_POLICY_THERMAL" = 1 + NVML_PERF_POLICY_SYNC_BOOST "NVML_PERF_POLICY_SYNC_BOOST" = 2 + NVML_PERF_POLICY_BOARD_LIMIT "NVML_PERF_POLICY_BOARD_LIMIT" = 3 + NVML_PERF_POLICY_LOW_UTILIZATION "NVML_PERF_POLICY_LOW_UTILIZATION" = 4 + NVML_PERF_POLICY_RELIABILITY "NVML_PERF_POLICY_RELIABILITY" = 5 + NVML_PERF_POLICY_TOTAL_APP_CLOCKS "NVML_PERF_POLICY_TOTAL_APP_CLOCKS" = 10 + NVML_PERF_POLICY_TOTAL_BASE_CLOCKS "NVML_PERF_POLICY_TOTAL_BASE_CLOCKS" = 11 + NVML_PERF_POLICY_COUNT "NVML_PERF_POLICY_COUNT" + +ctypedef enum nvmlThermalTarget_t "nvmlThermalTarget_t": + NVML_THERMAL_TARGET_NONE "NVML_THERMAL_TARGET_NONE" = 0 + NVML_THERMAL_TARGET_GPU "NVML_THERMAL_TARGET_GPU" = 1 + NVML_THERMAL_TARGET_MEMORY "NVML_THERMAL_TARGET_MEMORY" = 2 + NVML_THERMAL_TARGET_POWER_SUPPLY "NVML_THERMAL_TARGET_POWER_SUPPLY" = 4 + NVML_THERMAL_TARGET_BOARD "NVML_THERMAL_TARGET_BOARD" = 8 + NVML_THERMAL_TARGET_VCD_BOARD "NVML_THERMAL_TARGET_VCD_BOARD" = 9 + NVML_THERMAL_TARGET_VCD_INLET "NVML_THERMAL_TARGET_VCD_INLET" = 10 + NVML_THERMAL_TARGET_VCD_OUTLET "NVML_THERMAL_TARGET_VCD_OUTLET" = 11 + NVML_THERMAL_TARGET_ALL "NVML_THERMAL_TARGET_ALL" = 15 + NVML_THERMAL_TARGET_UNKNOWN "NVML_THERMAL_TARGET_UNKNOWN" = -(1) + +ctypedef enum nvmlThermalController_t "nvmlThermalController_t": + NVML_THERMAL_CONTROLLER_NONE "NVML_THERMAL_CONTROLLER_NONE" = 0 + NVML_THERMAL_CONTROLLER_GPU_INTERNAL "NVML_THERMAL_CONTROLLER_GPU_INTERNAL" + NVML_THERMAL_CONTROLLER_ADM1032 "NVML_THERMAL_CONTROLLER_ADM1032" + NVML_THERMAL_CONTROLLER_ADT7461 "NVML_THERMAL_CONTROLLER_ADT7461" + NVML_THERMAL_CONTROLLER_MAX6649 "NVML_THERMAL_CONTROLLER_MAX6649" + NVML_THERMAL_CONTROLLER_MAX1617 "NVML_THERMAL_CONTROLLER_MAX1617" + NVML_THERMAL_CONTROLLER_LM99 "NVML_THERMAL_CONTROLLER_LM99" + NVML_THERMAL_CONTROLLER_LM89 "NVML_THERMAL_CONTROLLER_LM89" + NVML_THERMAL_CONTROLLER_LM64 "NVML_THERMAL_CONTROLLER_LM64" + NVML_THERMAL_CONTROLLER_G781 "NVML_THERMAL_CONTROLLER_G781" + NVML_THERMAL_CONTROLLER_ADT7473 "NVML_THERMAL_CONTROLLER_ADT7473" + NVML_THERMAL_CONTROLLER_SBMAX6649 "NVML_THERMAL_CONTROLLER_SBMAX6649" + NVML_THERMAL_CONTROLLER_VBIOSEVT "NVML_THERMAL_CONTROLLER_VBIOSEVT" + NVML_THERMAL_CONTROLLER_OS "NVML_THERMAL_CONTROLLER_OS" + NVML_THERMAL_CONTROLLER_NVSYSCON_CANOAS "NVML_THERMAL_CONTROLLER_NVSYSCON_CANOAS" + NVML_THERMAL_CONTROLLER_NVSYSCON_E551 "NVML_THERMAL_CONTROLLER_NVSYSCON_E551" + NVML_THERMAL_CONTROLLER_MAX6649R "NVML_THERMAL_CONTROLLER_MAX6649R" + NVML_THERMAL_CONTROLLER_ADT7473S "NVML_THERMAL_CONTROLLER_ADT7473S" + NVML_THERMAL_CONTROLLER_UNKNOWN "NVML_THERMAL_CONTROLLER_UNKNOWN" = -(1) + +ctypedef enum nvmlCoolerControl_t "nvmlCoolerControl_t": + NVML_THERMAL_COOLER_SIGNAL_NONE "NVML_THERMAL_COOLER_SIGNAL_NONE" = 0 + NVML_THERMAL_COOLER_SIGNAL_TOGGLE "NVML_THERMAL_COOLER_SIGNAL_TOGGLE" = 1 + NVML_THERMAL_COOLER_SIGNAL_VARIABLE "NVML_THERMAL_COOLER_SIGNAL_VARIABLE" = 2 + NVML_THERMAL_COOLER_SIGNAL_COUNT "NVML_THERMAL_COOLER_SIGNAL_COUNT" + +ctypedef enum nvmlCoolerTarget_t "nvmlCoolerTarget_t": + NVML_THERMAL_COOLER_TARGET_NONE "NVML_THERMAL_COOLER_TARGET_NONE" = (1 << 0) + NVML_THERMAL_COOLER_TARGET_GPU "NVML_THERMAL_COOLER_TARGET_GPU" = (1 << 1) + NVML_THERMAL_COOLER_TARGET_MEMORY "NVML_THERMAL_COOLER_TARGET_MEMORY" = (1 << 2) + NVML_THERMAL_COOLER_TARGET_POWER_SUPPLY "NVML_THERMAL_COOLER_TARGET_POWER_SUPPLY" = (1 << 3) + NVML_THERMAL_COOLER_TARGET_GPU_RELATED "NVML_THERMAL_COOLER_TARGET_GPU_RELATED" = ((NVML_THERMAL_COOLER_TARGET_GPU | NVML_THERMAL_COOLER_TARGET_MEMORY) | NVML_THERMAL_COOLER_TARGET_POWER_SUPPLY) + +ctypedef enum nvmlUUIDType_t "nvmlUUIDType_t": + NVML_UUID_TYPE_NONE "NVML_UUID_TYPE_NONE" = 0 + NVML_UUID_TYPE_ASCII "NVML_UUID_TYPE_ASCII" = 1 + NVML_UUID_TYPE_BINARY "NVML_UUID_TYPE_BINARY" = 2 + +ctypedef enum nvmlEnableState_t "nvmlEnableState_t": + NVML_FEATURE_DISABLED "NVML_FEATURE_DISABLED" = 0 + NVML_FEATURE_ENABLED "NVML_FEATURE_ENABLED" = 1 + +ctypedef enum nvmlBrandType_t "nvmlBrandType_t": + NVML_BRAND_UNKNOWN "NVML_BRAND_UNKNOWN" = 0 + NVML_BRAND_QUADRO "NVML_BRAND_QUADRO" = 1 + NVML_BRAND_TESLA "NVML_BRAND_TESLA" = 2 + NVML_BRAND_NVS "NVML_BRAND_NVS" = 3 + NVML_BRAND_GRID "NVML_BRAND_GRID" = 4 + NVML_BRAND_GEFORCE "NVML_BRAND_GEFORCE" = 5 + NVML_BRAND_TITAN "NVML_BRAND_TITAN" = 6 + NVML_BRAND_NVIDIA_VAPPS "NVML_BRAND_NVIDIA_VAPPS" = 7 + NVML_BRAND_NVIDIA_VPC "NVML_BRAND_NVIDIA_VPC" = 8 + NVML_BRAND_NVIDIA_VCS "NVML_BRAND_NVIDIA_VCS" = 9 + NVML_BRAND_NVIDIA_VWS "NVML_BRAND_NVIDIA_VWS" = 10 + NVML_BRAND_NVIDIA_CLOUD_GAMING "NVML_BRAND_NVIDIA_CLOUD_GAMING" = 11 + NVML_BRAND_NVIDIA_VGAMING "NVML_BRAND_NVIDIA_VGAMING" = NVML_BRAND_NVIDIA_CLOUD_GAMING + NVML_BRAND_QUADRO_RTX "NVML_BRAND_QUADRO_RTX" = 12 + NVML_BRAND_NVIDIA_RTX "NVML_BRAND_NVIDIA_RTX" = 13 + NVML_BRAND_NVIDIA "NVML_BRAND_NVIDIA" = 14 + NVML_BRAND_GEFORCE_RTX "NVML_BRAND_GEFORCE_RTX" = 15 + NVML_BRAND_TITAN_RTX "NVML_BRAND_TITAN_RTX" = 16 + NVML_BRAND_COUNT "NVML_BRAND_COUNT" = 18 + +ctypedef enum nvmlTemperatureThresholds_t "nvmlTemperatureThresholds_t": + NVML_TEMPERATURE_THRESHOLD_SHUTDOWN "NVML_TEMPERATURE_THRESHOLD_SHUTDOWN" = 0 + NVML_TEMPERATURE_THRESHOLD_SLOWDOWN "NVML_TEMPERATURE_THRESHOLD_SLOWDOWN" = 1 + NVML_TEMPERATURE_THRESHOLD_MEM_MAX "NVML_TEMPERATURE_THRESHOLD_MEM_MAX" = 2 + NVML_TEMPERATURE_THRESHOLD_GPU_MAX "NVML_TEMPERATURE_THRESHOLD_GPU_MAX" = 3 + NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_MIN "NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_MIN" = 4 + NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_CURR "NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_CURR" = 5 + NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_MAX "NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_MAX" = 6 + NVML_TEMPERATURE_THRESHOLD_GPS_CURR "NVML_TEMPERATURE_THRESHOLD_GPS_CURR" = 7 + NVML_TEMPERATURE_THRESHOLD_COUNT "NVML_TEMPERATURE_THRESHOLD_COUNT" + +ctypedef enum nvmlTemperatureSensors_t "nvmlTemperatureSensors_t": + NVML_TEMPERATURE_GPU "NVML_TEMPERATURE_GPU" = 0 + NVML_TEMPERATURE_COUNT "NVML_TEMPERATURE_COUNT" + +ctypedef enum nvmlComputeMode_t "nvmlComputeMode_t": + NVML_COMPUTEMODE_DEFAULT "NVML_COMPUTEMODE_DEFAULT" = 0 + NVML_COMPUTEMODE_EXCLUSIVE_THREAD "NVML_COMPUTEMODE_EXCLUSIVE_THREAD" = 1 + NVML_COMPUTEMODE_PROHIBITED "NVML_COMPUTEMODE_PROHIBITED" = 2 + NVML_COMPUTEMODE_EXCLUSIVE_PROCESS "NVML_COMPUTEMODE_EXCLUSIVE_PROCESS" = 3 + NVML_COMPUTEMODE_COUNT "NVML_COMPUTEMODE_COUNT" + +ctypedef enum nvmlMemoryErrorType_t "nvmlMemoryErrorType_t": + NVML_MEMORY_ERROR_TYPE_CORRECTED "NVML_MEMORY_ERROR_TYPE_CORRECTED" = 0 + NVML_MEMORY_ERROR_TYPE_UNCORRECTED "NVML_MEMORY_ERROR_TYPE_UNCORRECTED" = 1 + NVML_MEMORY_ERROR_TYPE_COUNT "NVML_MEMORY_ERROR_TYPE_COUNT" + +ctypedef enum nvmlNvlinkVersion_t "nvmlNvlinkVersion_t": + NVML_NVLINK_VERSION_INVALID "NVML_NVLINK_VERSION_INVALID" = 0 + NVML_NVLINK_VERSION_1_0 "NVML_NVLINK_VERSION_1_0" = 1 + NVML_NVLINK_VERSION_2_0 "NVML_NVLINK_VERSION_2_0" = 2 + NVML_NVLINK_VERSION_2_2 "NVML_NVLINK_VERSION_2_2" = 3 + NVML_NVLINK_VERSION_3_0 "NVML_NVLINK_VERSION_3_0" = 4 + NVML_NVLINK_VERSION_3_1 "NVML_NVLINK_VERSION_3_1" = 5 + NVML_NVLINK_VERSION_4_0 "NVML_NVLINK_VERSION_4_0" = 6 + NVML_NVLINK_VERSION_5_0 "NVML_NVLINK_VERSION_5_0" = 7 + +ctypedef enum nvmlEccCounterType_t "nvmlEccCounterType_t": + NVML_VOLATILE_ECC "NVML_VOLATILE_ECC" = 0 + NVML_AGGREGATE_ECC "NVML_AGGREGATE_ECC" = 1 + NVML_ECC_COUNTER_TYPE_COUNT "NVML_ECC_COUNTER_TYPE_COUNT" + +ctypedef enum nvmlClockType_t "nvmlClockType_t": + NVML_CLOCK_GRAPHICS "NVML_CLOCK_GRAPHICS" = 0 + NVML_CLOCK_SM "NVML_CLOCK_SM" = 1 + NVML_CLOCK_MEM "NVML_CLOCK_MEM" = 2 + NVML_CLOCK_VIDEO "NVML_CLOCK_VIDEO" = 3 + NVML_CLOCK_COUNT "NVML_CLOCK_COUNT" + +ctypedef enum nvmlClockId_t "nvmlClockId_t": + NVML_CLOCK_ID_CURRENT "NVML_CLOCK_ID_CURRENT" = 0 + NVML_CLOCK_ID_APP_CLOCK_TARGET "NVML_CLOCK_ID_APP_CLOCK_TARGET" = 1 + NVML_CLOCK_ID_APP_CLOCK_DEFAULT "NVML_CLOCK_ID_APP_CLOCK_DEFAULT" = 2 + NVML_CLOCK_ID_CUSTOMER_BOOST_MAX "NVML_CLOCK_ID_CUSTOMER_BOOST_MAX" = 3 + NVML_CLOCK_ID_COUNT "NVML_CLOCK_ID_COUNT" + +ctypedef enum nvmlDriverModel_t "nvmlDriverModel_t": + NVML_DRIVER_WDDM "NVML_DRIVER_WDDM" = 0 + NVML_DRIVER_WDM "NVML_DRIVER_WDM" = 1 + NVML_DRIVER_MCDM "NVML_DRIVER_MCDM" = 2 + +ctypedef enum nvmlPstates_t "nvmlPstates_t": + NVML_PSTATE_0 "NVML_PSTATE_0" = 0 + NVML_PSTATE_1 "NVML_PSTATE_1" = 1 + NVML_PSTATE_2 "NVML_PSTATE_2" = 2 + NVML_PSTATE_3 "NVML_PSTATE_3" = 3 + NVML_PSTATE_4 "NVML_PSTATE_4" = 4 + NVML_PSTATE_5 "NVML_PSTATE_5" = 5 + NVML_PSTATE_6 "NVML_PSTATE_6" = 6 + NVML_PSTATE_7 "NVML_PSTATE_7" = 7 + NVML_PSTATE_8 "NVML_PSTATE_8" = 8 + NVML_PSTATE_9 "NVML_PSTATE_9" = 9 + NVML_PSTATE_10 "NVML_PSTATE_10" = 10 + NVML_PSTATE_11 "NVML_PSTATE_11" = 11 + NVML_PSTATE_12 "NVML_PSTATE_12" = 12 + NVML_PSTATE_13 "NVML_PSTATE_13" = 13 + NVML_PSTATE_14 "NVML_PSTATE_14" = 14 + NVML_PSTATE_15 "NVML_PSTATE_15" = 15 + NVML_PSTATE_UNKNOWN "NVML_PSTATE_UNKNOWN" = 32 + +ctypedef enum nvmlGpuOperationMode_t "nvmlGpuOperationMode_t": + NVML_GOM_ALL_ON "NVML_GOM_ALL_ON" = 0 + NVML_GOM_COMPUTE "NVML_GOM_COMPUTE" = 1 + NVML_GOM_LOW_DP "NVML_GOM_LOW_DP" = 2 + +ctypedef enum nvmlInforomObject_t "nvmlInforomObject_t": + NVML_INFOROM_OEM "NVML_INFOROM_OEM" = 0 + NVML_INFOROM_ECC "NVML_INFOROM_ECC" = 1 + NVML_INFOROM_POWER "NVML_INFOROM_POWER" = 2 + NVML_INFOROM_DEN "NVML_INFOROM_DEN" = 3 + NVML_INFOROM_COUNT "NVML_INFOROM_COUNT" + +ctypedef enum nvmlReturn_t "nvmlReturn_t": + NVML_SUCCESS "NVML_SUCCESS" = 0 + NVML_ERROR_UNINITIALIZED "NVML_ERROR_UNINITIALIZED" = 1 + NVML_ERROR_INVALID_ARGUMENT "NVML_ERROR_INVALID_ARGUMENT" = 2 + NVML_ERROR_NOT_SUPPORTED "NVML_ERROR_NOT_SUPPORTED" = 3 + NVML_ERROR_NO_PERMISSION "NVML_ERROR_NO_PERMISSION" = 4 + NVML_ERROR_ALREADY_INITIALIZED "NVML_ERROR_ALREADY_INITIALIZED" = 5 + NVML_ERROR_NOT_FOUND "NVML_ERROR_NOT_FOUND" = 6 + NVML_ERROR_INSUFFICIENT_SIZE "NVML_ERROR_INSUFFICIENT_SIZE" = 7 + NVML_ERROR_INSUFFICIENT_POWER "NVML_ERROR_INSUFFICIENT_POWER" = 8 + NVML_ERROR_DRIVER_NOT_LOADED "NVML_ERROR_DRIVER_NOT_LOADED" = 9 + NVML_ERROR_TIMEOUT "NVML_ERROR_TIMEOUT" = 10 + NVML_ERROR_IRQ_ISSUE "NVML_ERROR_IRQ_ISSUE" = 11 + NVML_ERROR_LIBRARY_NOT_FOUND "NVML_ERROR_LIBRARY_NOT_FOUND" = 12 + NVML_ERROR_FUNCTION_NOT_FOUND "NVML_ERROR_FUNCTION_NOT_FOUND" = 13 + NVML_ERROR_CORRUPTED_INFOROM "NVML_ERROR_CORRUPTED_INFOROM" = 14 + NVML_ERROR_GPU_IS_LOST "NVML_ERROR_GPU_IS_LOST" = 15 + NVML_ERROR_RESET_REQUIRED "NVML_ERROR_RESET_REQUIRED" = 16 + NVML_ERROR_OPERATING_SYSTEM "NVML_ERROR_OPERATING_SYSTEM" = 17 + NVML_ERROR_LIB_RM_VERSION_MISMATCH "NVML_ERROR_LIB_RM_VERSION_MISMATCH" = 18 + NVML_ERROR_IN_USE "NVML_ERROR_IN_USE" = 19 + NVML_ERROR_MEMORY "NVML_ERROR_MEMORY" = 20 + NVML_ERROR_NO_DATA "NVML_ERROR_NO_DATA" = 21 + NVML_ERROR_VGPU_ECC_NOT_SUPPORTED "NVML_ERROR_VGPU_ECC_NOT_SUPPORTED" = 22 + NVML_ERROR_INSUFFICIENT_RESOURCES "NVML_ERROR_INSUFFICIENT_RESOURCES" = 23 + NVML_ERROR_FREQ_NOT_SUPPORTED "NVML_ERROR_FREQ_NOT_SUPPORTED" = 24 + NVML_ERROR_ARGUMENT_VERSION_MISMATCH "NVML_ERROR_ARGUMENT_VERSION_MISMATCH" = 25 + NVML_ERROR_DEPRECATED "NVML_ERROR_DEPRECATED" = 26 + NVML_ERROR_NOT_READY "NVML_ERROR_NOT_READY" = 27 + NVML_ERROR_GPU_NOT_FOUND "NVML_ERROR_GPU_NOT_FOUND" = 28 + NVML_ERROR_INVALID_STATE "NVML_ERROR_INVALID_STATE" = 29 + NVML_ERROR_RESET_TYPE_NOT_SUPPORTED "NVML_ERROR_RESET_TYPE_NOT_SUPPORTED" = 30 + NVML_ERROR_UNKNOWN "NVML_ERROR_UNKNOWN" = 999 + _NVMLRETURN_T_INTERNAL_LOADING_ERROR "_NVMLRETURN_T_INTERNAL_LOADING_ERROR" = -42 + +ctypedef enum nvmlMemoryLocation_t "nvmlMemoryLocation_t": + NVML_MEMORY_LOCATION_L1_CACHE "NVML_MEMORY_LOCATION_L1_CACHE" = 0 + NVML_MEMORY_LOCATION_L2_CACHE "NVML_MEMORY_LOCATION_L2_CACHE" = 1 + NVML_MEMORY_LOCATION_DRAM "NVML_MEMORY_LOCATION_DRAM" = 2 + NVML_MEMORY_LOCATION_DEVICE_MEMORY "NVML_MEMORY_LOCATION_DEVICE_MEMORY" = 2 + NVML_MEMORY_LOCATION_REGISTER_FILE "NVML_MEMORY_LOCATION_REGISTER_FILE" = 3 + NVML_MEMORY_LOCATION_TEXTURE_MEMORY "NVML_MEMORY_LOCATION_TEXTURE_MEMORY" = 4 + NVML_MEMORY_LOCATION_TEXTURE_SHM "NVML_MEMORY_LOCATION_TEXTURE_SHM" = 5 + NVML_MEMORY_LOCATION_CBU "NVML_MEMORY_LOCATION_CBU" = 6 + NVML_MEMORY_LOCATION_SRAM "NVML_MEMORY_LOCATION_SRAM" = 7 + NVML_MEMORY_LOCATION_COUNT "NVML_MEMORY_LOCATION_COUNT" + +ctypedef enum nvmlPageRetirementCause_t "nvmlPageRetirementCause_t": + NVML_PAGE_RETIREMENT_CAUSE_MULTIPLE_SINGLE_BIT_ECC_ERRORS "NVML_PAGE_RETIREMENT_CAUSE_MULTIPLE_SINGLE_BIT_ECC_ERRORS" = 0 + NVML_PAGE_RETIREMENT_CAUSE_DOUBLE_BIT_ECC_ERROR "NVML_PAGE_RETIREMENT_CAUSE_DOUBLE_BIT_ECC_ERROR" = 1 + NVML_PAGE_RETIREMENT_CAUSE_COUNT "NVML_PAGE_RETIREMENT_CAUSE_COUNT" + +ctypedef enum nvmlRestrictedAPI_t "nvmlRestrictedAPI_t": + NVML_RESTRICTED_API_SET_APPLICATION_CLOCKS "NVML_RESTRICTED_API_SET_APPLICATION_CLOCKS" = 0 + NVML_RESTRICTED_API_SET_AUTO_BOOSTED_CLOCKS "NVML_RESTRICTED_API_SET_AUTO_BOOSTED_CLOCKS" = 1 + NVML_RESTRICTED_API_COUNT "NVML_RESTRICTED_API_COUNT" + +ctypedef enum nvmlGpuUtilizationDomainId_t "nvmlGpuUtilizationDomainId_t": + NVML_GPU_UTILIZATION_DOMAIN_GPU "NVML_GPU_UTILIZATION_DOMAIN_GPU" = 0 + NVML_GPU_UTILIZATION_DOMAIN_FB "NVML_GPU_UTILIZATION_DOMAIN_FB" = 1 + NVML_GPU_UTILIZATION_DOMAIN_VID "NVML_GPU_UTILIZATION_DOMAIN_VID" = 2 + NVML_GPU_UTILIZATION_DOMAIN_BUS "NVML_GPU_UTILIZATION_DOMAIN_BUS" = 3 + +ctypedef enum nvmlGpuVirtualizationMode_t "nvmlGpuVirtualizationMode_t": + NVML_GPU_VIRTUALIZATION_MODE_NONE "NVML_GPU_VIRTUALIZATION_MODE_NONE" = 0 + NVML_GPU_VIRTUALIZATION_MODE_PASSTHROUGH "NVML_GPU_VIRTUALIZATION_MODE_PASSTHROUGH" = 1 + NVML_GPU_VIRTUALIZATION_MODE_VGPU "NVML_GPU_VIRTUALIZATION_MODE_VGPU" = 2 + NVML_GPU_VIRTUALIZATION_MODE_HOST_VGPU "NVML_GPU_VIRTUALIZATION_MODE_HOST_VGPU" = 3 + NVML_GPU_VIRTUALIZATION_MODE_HOST_VSGA "NVML_GPU_VIRTUALIZATION_MODE_HOST_VSGA" = 4 + +ctypedef enum nvmlHostVgpuMode_t "nvmlHostVgpuMode_t": + NVML_HOST_VGPU_MODE_NON_SRIOV "NVML_HOST_VGPU_MODE_NON_SRIOV" = 0 + NVML_HOST_VGPU_MODE_SRIOV "NVML_HOST_VGPU_MODE_SRIOV" = 1 + +ctypedef enum nvmlVgpuVmIdType_t "nvmlVgpuVmIdType_t": + NVML_VGPU_VM_ID_DOMAIN_ID "NVML_VGPU_VM_ID_DOMAIN_ID" = 0 + NVML_VGPU_VM_ID_UUID "NVML_VGPU_VM_ID_UUID" = 1 + +ctypedef enum nvmlVgpuGuestInfoState_t "nvmlVgpuGuestInfoState_t": + NVML_VGPU_INSTANCE_GUEST_INFO_STATE_UNINITIALIZED "NVML_VGPU_INSTANCE_GUEST_INFO_STATE_UNINITIALIZED" = 0 + NVML_VGPU_INSTANCE_GUEST_INFO_STATE_INITIALIZED "NVML_VGPU_INSTANCE_GUEST_INFO_STATE_INITIALIZED" = 1 + +ctypedef enum nvmlGridLicenseFeatureCode_t "nvmlGridLicenseFeatureCode_t": + NVML_GRID_LICENSE_FEATURE_CODE_UNKNOWN "NVML_GRID_LICENSE_FEATURE_CODE_UNKNOWN" = 0 + NVML_GRID_LICENSE_FEATURE_CODE_VGPU "NVML_GRID_LICENSE_FEATURE_CODE_VGPU" = 1 + NVML_GRID_LICENSE_FEATURE_CODE_NVIDIA_RTX "NVML_GRID_LICENSE_FEATURE_CODE_NVIDIA_RTX" = 2 + NVML_GRID_LICENSE_FEATURE_CODE_VWORKSTATION "NVML_GRID_LICENSE_FEATURE_CODE_VWORKSTATION" = NVML_GRID_LICENSE_FEATURE_CODE_NVIDIA_RTX + NVML_GRID_LICENSE_FEATURE_CODE_GAMING "NVML_GRID_LICENSE_FEATURE_CODE_GAMING" = 3 + NVML_GRID_LICENSE_FEATURE_CODE_COMPUTE "NVML_GRID_LICENSE_FEATURE_CODE_COMPUTE" = 4 + +ctypedef enum nvmlVgpuCapability_t "nvmlVgpuCapability_t": + NVML_VGPU_CAP_NVLINK_P2P "NVML_VGPU_CAP_NVLINK_P2P" = 0 + NVML_VGPU_CAP_GPUDIRECT "NVML_VGPU_CAP_GPUDIRECT" = 1 + NVML_VGPU_CAP_MULTI_VGPU_EXCLUSIVE "NVML_VGPU_CAP_MULTI_VGPU_EXCLUSIVE" = 2 + NVML_VGPU_CAP_EXCLUSIVE_TYPE "NVML_VGPU_CAP_EXCLUSIVE_TYPE" = 3 + NVML_VGPU_CAP_EXCLUSIVE_SIZE "NVML_VGPU_CAP_EXCLUSIVE_SIZE" = 4 + NVML_VGPU_CAP_COUNT "NVML_VGPU_CAP_COUNT" + +ctypedef enum nvmlVgpuDriverCapability_t "nvmlVgpuDriverCapability_t": + NVML_VGPU_DRIVER_CAP_HETEROGENEOUS_MULTI_VGPU "NVML_VGPU_DRIVER_CAP_HETEROGENEOUS_MULTI_VGPU" = 0 + NVML_VGPU_DRIVER_CAP_WARM_UPDATE "NVML_VGPU_DRIVER_CAP_WARM_UPDATE" = 1 + NVML_VGPU_DRIVER_CAP_COUNT "NVML_VGPU_DRIVER_CAP_COUNT" + +ctypedef enum nvmlDeviceVgpuCapability_t "nvmlDeviceVgpuCapability_t": + NVML_DEVICE_VGPU_CAP_FRACTIONAL_MULTI_VGPU "NVML_DEVICE_VGPU_CAP_FRACTIONAL_MULTI_VGPU" = 0 + NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_PROFILES "NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_PROFILES" = 1 + NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_SIZES "NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_SIZES" = 2 + NVML_DEVICE_VGPU_CAP_READ_DEVICE_BUFFER_BW "NVML_DEVICE_VGPU_CAP_READ_DEVICE_BUFFER_BW" = 3 + NVML_DEVICE_VGPU_CAP_WRITE_DEVICE_BUFFER_BW "NVML_DEVICE_VGPU_CAP_WRITE_DEVICE_BUFFER_BW" = 4 + NVML_DEVICE_VGPU_CAP_DEVICE_STREAMING "NVML_DEVICE_VGPU_CAP_DEVICE_STREAMING" = 5 + NVML_DEVICE_VGPU_CAP_MINI_QUARTER_GPU "NVML_DEVICE_VGPU_CAP_MINI_QUARTER_GPU" = 6 + NVML_DEVICE_VGPU_CAP_COMPUTE_MEDIA_ENGINE_GPU "NVML_DEVICE_VGPU_CAP_COMPUTE_MEDIA_ENGINE_GPU" = 7 + NVML_DEVICE_VGPU_CAP_WARM_UPDATE "NVML_DEVICE_VGPU_CAP_WARM_UPDATE" = 8 + NVML_DEVICE_VGPU_CAP_HOMOGENEOUS_PLACEMENTS "NVML_DEVICE_VGPU_CAP_HOMOGENEOUS_PLACEMENTS" = 9 + NVML_DEVICE_VGPU_CAP_MIG_TIMESLICING_SUPPORTED "NVML_DEVICE_VGPU_CAP_MIG_TIMESLICING_SUPPORTED" = 10 + NVML_DEVICE_VGPU_CAP_MIG_TIMESLICING_ENABLED "NVML_DEVICE_VGPU_CAP_MIG_TIMESLICING_ENABLED" = 11 + NVML_DEVICE_VGPU_CAP_COUNT "NVML_DEVICE_VGPU_CAP_COUNT" + +ctypedef enum nvmlDeviceGpuRecoveryAction_t "nvmlDeviceGpuRecoveryAction_t": + NVML_GPU_RECOVERY_ACTION_NONE "NVML_GPU_RECOVERY_ACTION_NONE" = 0 + NVML_GPU_RECOVERY_ACTION_GPU_RESET "NVML_GPU_RECOVERY_ACTION_GPU_RESET" = 1 + NVML_GPU_RECOVERY_ACTION_NODE_REBOOT "NVML_GPU_RECOVERY_ACTION_NODE_REBOOT" = 2 + NVML_GPU_RECOVERY_ACTION_DRAIN_P2P "NVML_GPU_RECOVERY_ACTION_DRAIN_P2P" = 3 + NVML_GPU_RECOVERY_ACTION_DRAIN_AND_RESET "NVML_GPU_RECOVERY_ACTION_DRAIN_AND_RESET" = 4 + +ctypedef enum nvmlFanState_t "nvmlFanState_t": + NVML_FAN_NORMAL "NVML_FAN_NORMAL" = 0 + NVML_FAN_FAILED "NVML_FAN_FAILED" = 1 + +ctypedef enum nvmlLedColor_t "nvmlLedColor_t": + NVML_LED_COLOR_GREEN "NVML_LED_COLOR_GREEN" = 0 + NVML_LED_COLOR_AMBER "NVML_LED_COLOR_AMBER" = 1 + +ctypedef enum nvmlEncoderType_t "nvmlEncoderType_t": + NVML_ENCODER_QUERY_H264 "NVML_ENCODER_QUERY_H264" = 0x00 + NVML_ENCODER_QUERY_HEVC "NVML_ENCODER_QUERY_HEVC" = 0x01 + NVML_ENCODER_QUERY_AV1 "NVML_ENCODER_QUERY_AV1" = 0x02 + NVML_ENCODER_QUERY_UNKNOWN "NVML_ENCODER_QUERY_UNKNOWN" = 0xFF + +ctypedef enum nvmlFBCSessionType_t "nvmlFBCSessionType_t": + NVML_FBC_SESSION_TYPE_UNKNOWN "NVML_FBC_SESSION_TYPE_UNKNOWN" = 0 + NVML_FBC_SESSION_TYPE_TOSYS "NVML_FBC_SESSION_TYPE_TOSYS" + NVML_FBC_SESSION_TYPE_CUDA "NVML_FBC_SESSION_TYPE_CUDA" + NVML_FBC_SESSION_TYPE_VID "NVML_FBC_SESSION_TYPE_VID" + NVML_FBC_SESSION_TYPE_HWENC "NVML_FBC_SESSION_TYPE_HWENC" + +ctypedef enum nvmlDetachGpuState_t "nvmlDetachGpuState_t": + NVML_DETACH_GPU_KEEP "NVML_DETACH_GPU_KEEP" = 0 + NVML_DETACH_GPU_REMOVE "NVML_DETACH_GPU_REMOVE" + +ctypedef enum nvmlPcieLinkState_t "nvmlPcieLinkState_t": + NVML_PCIE_LINK_KEEP "NVML_PCIE_LINK_KEEP" = 0 + NVML_PCIE_LINK_SHUT_DOWN "NVML_PCIE_LINK_SHUT_DOWN" + +ctypedef enum nvmlClockLimitId_t "nvmlClockLimitId_t": + NVML_CLOCK_LIMIT_ID_RANGE_START "NVML_CLOCK_LIMIT_ID_RANGE_START" = 0xffffff00 + NVML_CLOCK_LIMIT_ID_TDP "NVML_CLOCK_LIMIT_ID_TDP" + NVML_CLOCK_LIMIT_ID_UNLIMITED "NVML_CLOCK_LIMIT_ID_UNLIMITED" + +ctypedef enum nvmlVgpuVmCompatibility_t "nvmlVgpuVmCompatibility_t": + NVML_VGPU_VM_COMPATIBILITY_NONE "NVML_VGPU_VM_COMPATIBILITY_NONE" = 0x0 + NVML_VGPU_VM_COMPATIBILITY_COLD "NVML_VGPU_VM_COMPATIBILITY_COLD" = 0x1 + NVML_VGPU_VM_COMPATIBILITY_HIBERNATE "NVML_VGPU_VM_COMPATIBILITY_HIBERNATE" = 0x2 + NVML_VGPU_VM_COMPATIBILITY_SLEEP "NVML_VGPU_VM_COMPATIBILITY_SLEEP" = 0x4 + NVML_VGPU_VM_COMPATIBILITY_LIVE "NVML_VGPU_VM_COMPATIBILITY_LIVE" = 0x8 + +ctypedef enum nvmlVgpuPgpuCompatibilityLimitCode_t "nvmlVgpuPgpuCompatibilityLimitCode_t": + NVML_VGPU_COMPATIBILITY_LIMIT_NONE "NVML_VGPU_COMPATIBILITY_LIMIT_NONE" = 0x0 + NVML_VGPU_COMPATIBILITY_LIMIT_HOST_DRIVER "NVML_VGPU_COMPATIBILITY_LIMIT_HOST_DRIVER" = 0x1 + NVML_VGPU_COMPATIBILITY_LIMIT_GUEST_DRIVER "NVML_VGPU_COMPATIBILITY_LIMIT_GUEST_DRIVER" = 0x2 + NVML_VGPU_COMPATIBILITY_LIMIT_GPU "NVML_VGPU_COMPATIBILITY_LIMIT_GPU" = 0x4 + NVML_VGPU_COMPATIBILITY_LIMIT_OTHER "NVML_VGPU_COMPATIBILITY_LIMIT_OTHER" = 0x80000000 + +ctypedef enum nvmlGpmMetricId_t "nvmlGpmMetricId_t": + NVML_GPM_METRIC_GRAPHICS_UTIL "NVML_GPM_METRIC_GRAPHICS_UTIL" = 1 + NVML_GPM_METRIC_SM_UTIL "NVML_GPM_METRIC_SM_UTIL" = 2 + NVML_GPM_METRIC_SM_OCCUPANCY "NVML_GPM_METRIC_SM_OCCUPANCY" = 3 + NVML_GPM_METRIC_INTEGER_UTIL "NVML_GPM_METRIC_INTEGER_UTIL" = 4 + NVML_GPM_METRIC_ANY_TENSOR_UTIL "NVML_GPM_METRIC_ANY_TENSOR_UTIL" = 5 + NVML_GPM_METRIC_DFMA_TENSOR_UTIL "NVML_GPM_METRIC_DFMA_TENSOR_UTIL" = 6 + NVML_GPM_METRIC_HMMA_TENSOR_UTIL "NVML_GPM_METRIC_HMMA_TENSOR_UTIL" = 7 + NVML_GPM_METRIC_IMMA_TENSOR_UTIL "NVML_GPM_METRIC_IMMA_TENSOR_UTIL" = 9 + NVML_GPM_METRIC_DRAM_BW_UTIL "NVML_GPM_METRIC_DRAM_BW_UTIL" = 10 + NVML_GPM_METRIC_FP64_UTIL "NVML_GPM_METRIC_FP64_UTIL" = 11 + NVML_GPM_METRIC_FP32_UTIL "NVML_GPM_METRIC_FP32_UTIL" = 12 + NVML_GPM_METRIC_FP16_UTIL "NVML_GPM_METRIC_FP16_UTIL" = 13 + NVML_GPM_METRIC_PCIE_TX_PER_SEC "NVML_GPM_METRIC_PCIE_TX_PER_SEC" = 20 + NVML_GPM_METRIC_PCIE_RX_PER_SEC "NVML_GPM_METRIC_PCIE_RX_PER_SEC" = 21 + NVML_GPM_METRIC_NVDEC_0_UTIL "NVML_GPM_METRIC_NVDEC_0_UTIL" = 30 + NVML_GPM_METRIC_NVDEC_1_UTIL "NVML_GPM_METRIC_NVDEC_1_UTIL" = 31 + NVML_GPM_METRIC_NVDEC_2_UTIL "NVML_GPM_METRIC_NVDEC_2_UTIL" = 32 + NVML_GPM_METRIC_NVDEC_3_UTIL "NVML_GPM_METRIC_NVDEC_3_UTIL" = 33 + NVML_GPM_METRIC_NVDEC_4_UTIL "NVML_GPM_METRIC_NVDEC_4_UTIL" = 34 + NVML_GPM_METRIC_NVDEC_5_UTIL "NVML_GPM_METRIC_NVDEC_5_UTIL" = 35 + NVML_GPM_METRIC_NVDEC_6_UTIL "NVML_GPM_METRIC_NVDEC_6_UTIL" = 36 + NVML_GPM_METRIC_NVDEC_7_UTIL "NVML_GPM_METRIC_NVDEC_7_UTIL" = 37 + NVML_GPM_METRIC_NVJPG_0_UTIL "NVML_GPM_METRIC_NVJPG_0_UTIL" = 40 + NVML_GPM_METRIC_NVJPG_1_UTIL "NVML_GPM_METRIC_NVJPG_1_UTIL" = 41 + NVML_GPM_METRIC_NVJPG_2_UTIL "NVML_GPM_METRIC_NVJPG_2_UTIL" = 42 + NVML_GPM_METRIC_NVJPG_3_UTIL "NVML_GPM_METRIC_NVJPG_3_UTIL" = 43 + NVML_GPM_METRIC_NVJPG_4_UTIL "NVML_GPM_METRIC_NVJPG_4_UTIL" = 44 + NVML_GPM_METRIC_NVJPG_5_UTIL "NVML_GPM_METRIC_NVJPG_5_UTIL" = 45 + NVML_GPM_METRIC_NVJPG_6_UTIL "NVML_GPM_METRIC_NVJPG_6_UTIL" = 46 + NVML_GPM_METRIC_NVJPG_7_UTIL "NVML_GPM_METRIC_NVJPG_7_UTIL" = 47 + NVML_GPM_METRIC_NVOFA_0_UTIL "NVML_GPM_METRIC_NVOFA_0_UTIL" = 50 + NVML_GPM_METRIC_NVOFA_1_UTIL "NVML_GPM_METRIC_NVOFA_1_UTIL" = 51 + NVML_GPM_METRIC_NVLINK_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_TOTAL_RX_PER_SEC" = 60 + NVML_GPM_METRIC_NVLINK_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_TOTAL_TX_PER_SEC" = 61 + NVML_GPM_METRIC_NVLINK_L0_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L0_RX_PER_SEC" = 62 + NVML_GPM_METRIC_NVLINK_L0_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L0_TX_PER_SEC" = 63 + NVML_GPM_METRIC_NVLINK_L1_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L1_RX_PER_SEC" = 64 + NVML_GPM_METRIC_NVLINK_L1_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L1_TX_PER_SEC" = 65 + NVML_GPM_METRIC_NVLINK_L2_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L2_RX_PER_SEC" = 66 + NVML_GPM_METRIC_NVLINK_L2_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L2_TX_PER_SEC" = 67 + NVML_GPM_METRIC_NVLINK_L3_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L3_RX_PER_SEC" = 68 + NVML_GPM_METRIC_NVLINK_L3_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L3_TX_PER_SEC" = 69 + NVML_GPM_METRIC_NVLINK_L4_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L4_RX_PER_SEC" = 70 + NVML_GPM_METRIC_NVLINK_L4_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L4_TX_PER_SEC" = 71 + NVML_GPM_METRIC_NVLINK_L5_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L5_RX_PER_SEC" = 72 + NVML_GPM_METRIC_NVLINK_L5_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L5_TX_PER_SEC" = 73 + NVML_GPM_METRIC_NVLINK_L6_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L6_RX_PER_SEC" = 74 + NVML_GPM_METRIC_NVLINK_L6_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L6_TX_PER_SEC" = 75 + NVML_GPM_METRIC_NVLINK_L7_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L7_RX_PER_SEC" = 76 + NVML_GPM_METRIC_NVLINK_L7_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L7_TX_PER_SEC" = 77 + NVML_GPM_METRIC_NVLINK_L8_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L8_RX_PER_SEC" = 78 + NVML_GPM_METRIC_NVLINK_L8_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L8_TX_PER_SEC" = 79 + NVML_GPM_METRIC_NVLINK_L9_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L9_RX_PER_SEC" = 80 + NVML_GPM_METRIC_NVLINK_L9_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L9_TX_PER_SEC" = 81 + NVML_GPM_METRIC_NVLINK_L10_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L10_RX_PER_SEC" = 82 + NVML_GPM_METRIC_NVLINK_L10_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L10_TX_PER_SEC" = 83 + NVML_GPM_METRIC_NVLINK_L11_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L11_RX_PER_SEC" = 84 + NVML_GPM_METRIC_NVLINK_L11_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L11_TX_PER_SEC" = 85 + NVML_GPM_METRIC_NVLINK_L12_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L12_RX_PER_SEC" = 86 + NVML_GPM_METRIC_NVLINK_L12_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L12_TX_PER_SEC" = 87 + NVML_GPM_METRIC_NVLINK_L13_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L13_RX_PER_SEC" = 88 + NVML_GPM_METRIC_NVLINK_L13_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L13_TX_PER_SEC" = 89 + NVML_GPM_METRIC_NVLINK_L14_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L14_RX_PER_SEC" = 90 + NVML_GPM_METRIC_NVLINK_L14_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L14_TX_PER_SEC" = 91 + NVML_GPM_METRIC_NVLINK_L15_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L15_RX_PER_SEC" = 92 + NVML_GPM_METRIC_NVLINK_L15_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L15_TX_PER_SEC" = 93 + NVML_GPM_METRIC_NVLINK_L16_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L16_RX_PER_SEC" = 94 + NVML_GPM_METRIC_NVLINK_L16_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L16_TX_PER_SEC" = 95 + NVML_GPM_METRIC_NVLINK_L17_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L17_RX_PER_SEC" = 96 + NVML_GPM_METRIC_NVLINK_L17_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L17_TX_PER_SEC" = 97 + NVML_GPM_METRIC_C2C_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_TOTAL_TX_PER_SEC" = 100 + NVML_GPM_METRIC_C2C_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_TOTAL_RX_PER_SEC" = 101 + NVML_GPM_METRIC_C2C_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_DATA_TX_PER_SEC" = 102 + NVML_GPM_METRIC_C2C_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_DATA_RX_PER_SEC" = 103 + NVML_GPM_METRIC_C2C_LINK0_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK0_TOTAL_TX_PER_SEC" = 104 + NVML_GPM_METRIC_C2C_LINK0_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK0_TOTAL_RX_PER_SEC" = 105 + NVML_GPM_METRIC_C2C_LINK0_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK0_DATA_TX_PER_SEC" = 106 + NVML_GPM_METRIC_C2C_LINK0_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK0_DATA_RX_PER_SEC" = 107 + NVML_GPM_METRIC_C2C_LINK1_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK1_TOTAL_TX_PER_SEC" = 108 + NVML_GPM_METRIC_C2C_LINK1_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK1_TOTAL_RX_PER_SEC" = 109 + NVML_GPM_METRIC_C2C_LINK1_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK1_DATA_TX_PER_SEC" = 110 + NVML_GPM_METRIC_C2C_LINK1_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK1_DATA_RX_PER_SEC" = 111 + NVML_GPM_METRIC_C2C_LINK2_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK2_TOTAL_TX_PER_SEC" = 112 + NVML_GPM_METRIC_C2C_LINK2_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK2_TOTAL_RX_PER_SEC" = 113 + NVML_GPM_METRIC_C2C_LINK2_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK2_DATA_TX_PER_SEC" = 114 + NVML_GPM_METRIC_C2C_LINK2_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK2_DATA_RX_PER_SEC" = 115 + NVML_GPM_METRIC_C2C_LINK3_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK3_TOTAL_TX_PER_SEC" = 116 + NVML_GPM_METRIC_C2C_LINK3_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK3_TOTAL_RX_PER_SEC" = 117 + NVML_GPM_METRIC_C2C_LINK3_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK3_DATA_TX_PER_SEC" = 118 + NVML_GPM_METRIC_C2C_LINK3_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK3_DATA_RX_PER_SEC" = 119 + NVML_GPM_METRIC_C2C_LINK4_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK4_TOTAL_TX_PER_SEC" = 120 + NVML_GPM_METRIC_C2C_LINK4_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK4_TOTAL_RX_PER_SEC" = 121 + NVML_GPM_METRIC_C2C_LINK4_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK4_DATA_TX_PER_SEC" = 122 + NVML_GPM_METRIC_C2C_LINK4_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK4_DATA_RX_PER_SEC" = 123 + NVML_GPM_METRIC_C2C_LINK5_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK5_TOTAL_TX_PER_SEC" = 124 + NVML_GPM_METRIC_C2C_LINK5_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK5_TOTAL_RX_PER_SEC" = 125 + NVML_GPM_METRIC_C2C_LINK5_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK5_DATA_TX_PER_SEC" = 126 + NVML_GPM_METRIC_C2C_LINK5_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK5_DATA_RX_PER_SEC" = 127 + NVML_GPM_METRIC_C2C_LINK6_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK6_TOTAL_TX_PER_SEC" = 128 + NVML_GPM_METRIC_C2C_LINK6_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK6_TOTAL_RX_PER_SEC" = 129 + NVML_GPM_METRIC_C2C_LINK6_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK6_DATA_TX_PER_SEC" = 130 + NVML_GPM_METRIC_C2C_LINK6_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK6_DATA_RX_PER_SEC" = 131 + NVML_GPM_METRIC_C2C_LINK7_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK7_TOTAL_TX_PER_SEC" = 132 + NVML_GPM_METRIC_C2C_LINK7_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK7_TOTAL_RX_PER_SEC" = 133 + NVML_GPM_METRIC_C2C_LINK7_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK7_DATA_TX_PER_SEC" = 134 + NVML_GPM_METRIC_C2C_LINK7_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK7_DATA_RX_PER_SEC" = 135 + NVML_GPM_METRIC_C2C_LINK8_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK8_TOTAL_TX_PER_SEC" = 136 + NVML_GPM_METRIC_C2C_LINK8_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK8_TOTAL_RX_PER_SEC" = 137 + NVML_GPM_METRIC_C2C_LINK8_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK8_DATA_TX_PER_SEC" = 138 + NVML_GPM_METRIC_C2C_LINK8_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK8_DATA_RX_PER_SEC" = 139 + NVML_GPM_METRIC_C2C_LINK9_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK9_TOTAL_TX_PER_SEC" = 140 + NVML_GPM_METRIC_C2C_LINK9_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK9_TOTAL_RX_PER_SEC" = 141 + NVML_GPM_METRIC_C2C_LINK9_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK9_DATA_TX_PER_SEC" = 142 + NVML_GPM_METRIC_C2C_LINK9_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK9_DATA_RX_PER_SEC" = 143 + NVML_GPM_METRIC_C2C_LINK10_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK10_TOTAL_TX_PER_SEC" = 144 + NVML_GPM_METRIC_C2C_LINK10_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK10_TOTAL_RX_PER_SEC" = 145 + NVML_GPM_METRIC_C2C_LINK10_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK10_DATA_TX_PER_SEC" = 146 + NVML_GPM_METRIC_C2C_LINK10_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK10_DATA_RX_PER_SEC" = 147 + NVML_GPM_METRIC_C2C_LINK11_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK11_TOTAL_TX_PER_SEC" = 148 + NVML_GPM_METRIC_C2C_LINK11_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK11_TOTAL_RX_PER_SEC" = 149 + NVML_GPM_METRIC_C2C_LINK11_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK11_DATA_TX_PER_SEC" = 150 + NVML_GPM_METRIC_C2C_LINK11_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK11_DATA_RX_PER_SEC" = 151 + NVML_GPM_METRIC_C2C_LINK12_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK12_TOTAL_TX_PER_SEC" = 152 + NVML_GPM_METRIC_C2C_LINK12_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK12_TOTAL_RX_PER_SEC" = 153 + NVML_GPM_METRIC_C2C_LINK12_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK12_DATA_TX_PER_SEC" = 154 + NVML_GPM_METRIC_C2C_LINK12_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK12_DATA_RX_PER_SEC" = 155 + NVML_GPM_METRIC_C2C_LINK13_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK13_TOTAL_TX_PER_SEC" = 156 + NVML_GPM_METRIC_C2C_LINK13_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK13_TOTAL_RX_PER_SEC" = 157 + NVML_GPM_METRIC_C2C_LINK13_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK13_DATA_TX_PER_SEC" = 158 + NVML_GPM_METRIC_C2C_LINK13_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK13_DATA_RX_PER_SEC" = 159 + NVML_GPM_METRIC_HOSTMEM_CACHE_HIT "NVML_GPM_METRIC_HOSTMEM_CACHE_HIT" = 160 + NVML_GPM_METRIC_HOSTMEM_CACHE_MISS "NVML_GPM_METRIC_HOSTMEM_CACHE_MISS" = 161 + NVML_GPM_METRIC_PEERMEM_CACHE_HIT "NVML_GPM_METRIC_PEERMEM_CACHE_HIT" = 162 + NVML_GPM_METRIC_PEERMEM_CACHE_MISS "NVML_GPM_METRIC_PEERMEM_CACHE_MISS" = 163 + NVML_GPM_METRIC_DRAM_CACHE_HIT "NVML_GPM_METRIC_DRAM_CACHE_HIT" = 164 + NVML_GPM_METRIC_DRAM_CACHE_MISS "NVML_GPM_METRIC_DRAM_CACHE_MISS" = 165 + NVML_GPM_METRIC_NVENC_0_UTIL "NVML_GPM_METRIC_NVENC_0_UTIL" = 166 + NVML_GPM_METRIC_NVENC_1_UTIL "NVML_GPM_METRIC_NVENC_1_UTIL" = 167 + NVML_GPM_METRIC_NVENC_2_UTIL "NVML_GPM_METRIC_NVENC_2_UTIL" = 168 + NVML_GPM_METRIC_NVENC_3_UTIL "NVML_GPM_METRIC_NVENC_3_UTIL" = 169 + NVML_GPM_METRIC_GR0_CTXSW_CYCLES_ELAPSED "NVML_GPM_METRIC_GR0_CTXSW_CYCLES_ELAPSED" = 170 + NVML_GPM_METRIC_GR0_CTXSW_CYCLES_ACTIVE "NVML_GPM_METRIC_GR0_CTXSW_CYCLES_ACTIVE" = 171 + NVML_GPM_METRIC_GR0_CTXSW_REQUESTS "NVML_GPM_METRIC_GR0_CTXSW_REQUESTS" = 172 + NVML_GPM_METRIC_GR0_CTXSW_CYCLES_PER_REQ "NVML_GPM_METRIC_GR0_CTXSW_CYCLES_PER_REQ" = 173 + NVML_GPM_METRIC_GR0_CTXSW_ACTIVE_PCT "NVML_GPM_METRIC_GR0_CTXSW_ACTIVE_PCT" = 174 + NVML_GPM_METRIC_GR1_CTXSW_CYCLES_ELAPSED "NVML_GPM_METRIC_GR1_CTXSW_CYCLES_ELAPSED" = 175 + NVML_GPM_METRIC_GR1_CTXSW_CYCLES_ACTIVE "NVML_GPM_METRIC_GR1_CTXSW_CYCLES_ACTIVE" = 176 + NVML_GPM_METRIC_GR1_CTXSW_REQUESTS "NVML_GPM_METRIC_GR1_CTXSW_REQUESTS" = 177 + NVML_GPM_METRIC_GR1_CTXSW_CYCLES_PER_REQ "NVML_GPM_METRIC_GR1_CTXSW_CYCLES_PER_REQ" = 178 + NVML_GPM_METRIC_GR1_CTXSW_ACTIVE_PCT "NVML_GPM_METRIC_GR1_CTXSW_ACTIVE_PCT" = 179 + NVML_GPM_METRIC_GR2_CTXSW_CYCLES_ELAPSED "NVML_GPM_METRIC_GR2_CTXSW_CYCLES_ELAPSED" = 180 + NVML_GPM_METRIC_GR2_CTXSW_CYCLES_ACTIVE "NVML_GPM_METRIC_GR2_CTXSW_CYCLES_ACTIVE" = 181 + NVML_GPM_METRIC_GR2_CTXSW_REQUESTS "NVML_GPM_METRIC_GR2_CTXSW_REQUESTS" = 182 + NVML_GPM_METRIC_GR2_CTXSW_CYCLES_PER_REQ "NVML_GPM_METRIC_GR2_CTXSW_CYCLES_PER_REQ" = 183 + NVML_GPM_METRIC_GR2_CTXSW_ACTIVE_PCT "NVML_GPM_METRIC_GR2_CTXSW_ACTIVE_PCT" = 184 + NVML_GPM_METRIC_GR3_CTXSW_CYCLES_ELAPSED "NVML_GPM_METRIC_GR3_CTXSW_CYCLES_ELAPSED" = 185 + NVML_GPM_METRIC_GR3_CTXSW_CYCLES_ACTIVE "NVML_GPM_METRIC_GR3_CTXSW_CYCLES_ACTIVE" = 186 + NVML_GPM_METRIC_GR3_CTXSW_REQUESTS "NVML_GPM_METRIC_GR3_CTXSW_REQUESTS" = 187 + NVML_GPM_METRIC_GR3_CTXSW_CYCLES_PER_REQ "NVML_GPM_METRIC_GR3_CTXSW_CYCLES_PER_REQ" = 188 + NVML_GPM_METRIC_GR3_CTXSW_ACTIVE_PCT "NVML_GPM_METRIC_GR3_CTXSW_ACTIVE_PCT" = 189 + NVML_GPM_METRIC_GR4_CTXSW_CYCLES_ELAPSED "NVML_GPM_METRIC_GR4_CTXSW_CYCLES_ELAPSED" = 190 + NVML_GPM_METRIC_GR4_CTXSW_CYCLES_ACTIVE "NVML_GPM_METRIC_GR4_CTXSW_CYCLES_ACTIVE" = 191 + NVML_GPM_METRIC_GR4_CTXSW_REQUESTS "NVML_GPM_METRIC_GR4_CTXSW_REQUESTS" = 192 + NVML_GPM_METRIC_GR4_CTXSW_CYCLES_PER_REQ "NVML_GPM_METRIC_GR4_CTXSW_CYCLES_PER_REQ" = 193 + NVML_GPM_METRIC_GR4_CTXSW_ACTIVE_PCT "NVML_GPM_METRIC_GR4_CTXSW_ACTIVE_PCT" = 194 + NVML_GPM_METRIC_GR5_CTXSW_CYCLES_ELAPSED "NVML_GPM_METRIC_GR5_CTXSW_CYCLES_ELAPSED" = 195 + NVML_GPM_METRIC_GR5_CTXSW_CYCLES_ACTIVE "NVML_GPM_METRIC_GR5_CTXSW_CYCLES_ACTIVE" = 196 + NVML_GPM_METRIC_GR5_CTXSW_REQUESTS "NVML_GPM_METRIC_GR5_CTXSW_REQUESTS" = 197 + NVML_GPM_METRIC_GR5_CTXSW_CYCLES_PER_REQ "NVML_GPM_METRIC_GR5_CTXSW_CYCLES_PER_REQ" = 198 + NVML_GPM_METRIC_GR5_CTXSW_ACTIVE_PCT "NVML_GPM_METRIC_GR5_CTXSW_ACTIVE_PCT" = 199 + NVML_GPM_METRIC_GR6_CTXSW_CYCLES_ELAPSED "NVML_GPM_METRIC_GR6_CTXSW_CYCLES_ELAPSED" = 200 + NVML_GPM_METRIC_GR6_CTXSW_CYCLES_ACTIVE "NVML_GPM_METRIC_GR6_CTXSW_CYCLES_ACTIVE" = 201 + NVML_GPM_METRIC_GR6_CTXSW_REQUESTS "NVML_GPM_METRIC_GR6_CTXSW_REQUESTS" = 202 + NVML_GPM_METRIC_GR6_CTXSW_CYCLES_PER_REQ "NVML_GPM_METRIC_GR6_CTXSW_CYCLES_PER_REQ" = 203 + NVML_GPM_METRIC_GR6_CTXSW_ACTIVE_PCT "NVML_GPM_METRIC_GR6_CTXSW_ACTIVE_PCT" = 204 + NVML_GPM_METRIC_GR7_CTXSW_CYCLES_ELAPSED "NVML_GPM_METRIC_GR7_CTXSW_CYCLES_ELAPSED" = 205 + NVML_GPM_METRIC_GR7_CTXSW_CYCLES_ACTIVE "NVML_GPM_METRIC_GR7_CTXSW_CYCLES_ACTIVE" = 206 + NVML_GPM_METRIC_GR7_CTXSW_REQUESTS "NVML_GPM_METRIC_GR7_CTXSW_REQUESTS" = 207 + NVML_GPM_METRIC_GR7_CTXSW_CYCLES_PER_REQ "NVML_GPM_METRIC_GR7_CTXSW_CYCLES_PER_REQ" = 208 + NVML_GPM_METRIC_GR7_CTXSW_ACTIVE_PCT "NVML_GPM_METRIC_GR7_CTXSW_ACTIVE_PCT" = 209 + NVML_GPM_METRIC_MAX "NVML_GPM_METRIC_MAX" = 210 + +ctypedef enum nvmlPowerProfileType_t "nvmlPowerProfileType_t": + NVML_POWER_PROFILE_MAX_P "NVML_POWER_PROFILE_MAX_P" = 0 + NVML_POWER_PROFILE_MAX_Q "NVML_POWER_PROFILE_MAX_Q" = 1 + NVML_POWER_PROFILE_COMPUTE "NVML_POWER_PROFILE_COMPUTE" = 2 + NVML_POWER_PROFILE_MEMORY_BOUND "NVML_POWER_PROFILE_MEMORY_BOUND" = 3 + NVML_POWER_PROFILE_NETWORK "NVML_POWER_PROFILE_NETWORK" = 4 + NVML_POWER_PROFILE_BALANCED "NVML_POWER_PROFILE_BALANCED" = 5 + NVML_POWER_PROFILE_LLM_INFERENCE "NVML_POWER_PROFILE_LLM_INFERENCE" = 6 + NVML_POWER_PROFILE_LLM_TRAINING "NVML_POWER_PROFILE_LLM_TRAINING" = 7 + NVML_POWER_PROFILE_RBM "NVML_POWER_PROFILE_RBM" = 8 + NVML_POWER_PROFILE_DCPCIE "NVML_POWER_PROFILE_DCPCIE" = 9 + NVML_POWER_PROFILE_HMMA_SPARSE "NVML_POWER_PROFILE_HMMA_SPARSE" = 10 + NVML_POWER_PROFILE_HMMA_DENSE "NVML_POWER_PROFILE_HMMA_DENSE" = 11 + NVML_POWER_PROFILE_SYNC_BALANCED "NVML_POWER_PROFILE_SYNC_BALANCED" = 12 + NVML_POWER_PROFILE_HPC "NVML_POWER_PROFILE_HPC" = 13 + NVML_POWER_PROFILE_MIG "NVML_POWER_PROFILE_MIG" = 14 + NVML_POWER_PROFILE_MAX "NVML_POWER_PROFILE_MAX" = 15 + +ctypedef enum nvmlDeviceAddressingModeType_t "nvmlDeviceAddressingModeType_t": + NVML_DEVICE_ADDRESSING_MODE_NONE "NVML_DEVICE_ADDRESSING_MODE_NONE" = 0 + NVML_DEVICE_ADDRESSING_MODE_HMM "NVML_DEVICE_ADDRESSING_MODE_HMM" = 1 + NVML_DEVICE_ADDRESSING_MODE_ATS "NVML_DEVICE_ADDRESSING_MODE_ATS" = 2 + + +# types +ctypedef struct nvmlPciInfoExt_v1_t 'nvmlPciInfoExt_v1_t': + unsigned int version + unsigned int domain + unsigned int bus + unsigned int device + unsigned int pciDeviceId + unsigned int pciSubSystemId + unsigned int baseClass + unsigned int subClass + char busId[32] + +ctypedef struct nvmlCoolerInfo_v1_t 'nvmlCoolerInfo_v1_t': + unsigned int version + unsigned int index + nvmlCoolerControl_t signalType + nvmlCoolerTarget_t target + +ctypedef struct nvmlDramEncryptionInfo_v1_t 'nvmlDramEncryptionInfo_v1_t': + unsigned int version + nvmlEnableState_t encryptionState + +ctypedef struct nvmlMarginTemperature_v1_t 'nvmlMarginTemperature_v1_t': + unsigned int version + int marginTemperature + +ctypedef struct nvmlClockOffset_v1_t 'nvmlClockOffset_v1_t': + unsigned int version + nvmlClockType_t type + nvmlPstates_t pstate + int clockOffsetMHz + int minClockOffsetMHz + int maxClockOffsetMHz + +ctypedef struct nvmlFanSpeedInfo_v1_t 'nvmlFanSpeedInfo_v1_t': + unsigned int version + unsigned int fan + unsigned int speed + +ctypedef struct nvmlDevicePerfModes_v1_t 'nvmlDevicePerfModes_v1_t': + unsigned int version + char str[2048] + +ctypedef struct nvmlDeviceCurrentClockFreqs_v1_t 'nvmlDeviceCurrentClockFreqs_v1_t': + unsigned int version + char str[2048] + +ctypedef struct nvmlEccSramErrorStatus_v1_t 'nvmlEccSramErrorStatus_v1_t': + unsigned int version + unsigned long long aggregateUncParity + unsigned long long aggregateUncSecDed + unsigned long long aggregateCor + unsigned long long volatileUncParity + unsigned long long volatileUncSecDed + unsigned long long volatileCor + unsigned long long aggregateUncBucketL2 + unsigned long long aggregateUncBucketSm + unsigned long long aggregateUncBucketPcie + unsigned long long aggregateUncBucketMcu + unsigned long long aggregateUncBucketOther + unsigned int bThresholdExceeded + +ctypedef struct nvmlPlatformInfo_v2_t 'nvmlPlatformInfo_v2_t': + unsigned int version + unsigned char ibGuid[16] + unsigned char chassisSerialNumber[16] + unsigned char slotNumber + unsigned char trayIndex + unsigned char hostId + unsigned char peerType + unsigned char moduleId + +ctypedef unsigned int nvmlDeviceArchitecture_t 'nvmlDeviceArchitecture_t' +ctypedef unsigned int nvmlBusType_t 'nvmlBusType_t' +ctypedef unsigned int nvmlFanControlPolicy_t 'nvmlFanControlPolicy_t' +ctypedef unsigned int nvmlPowerSource_t 'nvmlPowerSource_t' +ctypedef unsigned char nvmlPowerScopeType_t 'nvmlPowerScopeType_t' +ctypedef unsigned int nvmlVgpuTypeId_t 'nvmlVgpuTypeId_t' +ctypedef unsigned int nvmlVgpuInstance_t 'nvmlVgpuInstance_t' +ctypedef struct nvmlVgpuHeterogeneousMode_v1_t 'nvmlVgpuHeterogeneousMode_v1_t': + unsigned int version + unsigned int mode + +ctypedef struct nvmlVgpuPlacementId_v1_t 'nvmlVgpuPlacementId_v1_t': + unsigned int version + unsigned int placementId + +ctypedef struct nvmlVgpuPlacementList_v2_t 'nvmlVgpuPlacementList_v2_t': + unsigned int version + unsigned int placementSize + unsigned int count + unsigned int* placementIds + unsigned int mode + +ctypedef struct nvmlVgpuTypeBar1Info_v1_t 'nvmlVgpuTypeBar1Info_v1_t': + unsigned int version + unsigned long long bar1Size + +ctypedef struct nvmlVgpuRuntimeState_v1_t 'nvmlVgpuRuntimeState_v1_t': + unsigned int version + unsigned long long size + +ctypedef struct nvmlSystemConfComputeSettings_v1_t 'nvmlSystemConfComputeSettings_v1_t': + unsigned int version + unsigned int environment + unsigned int ccFeature + unsigned int devToolsMode + unsigned int multiGpuMode + +ctypedef struct nvmlConfComputeSetKeyRotationThresholdInfo_v1_t 'nvmlConfComputeSetKeyRotationThresholdInfo_v1_t': + unsigned int version + unsigned long long maxAttackerAdvantage + +ctypedef struct nvmlConfComputeGetKeyRotationThresholdInfo_v1_t 'nvmlConfComputeGetKeyRotationThresholdInfo_v1_t': + unsigned int version + unsigned long long attackerAdvantage + +ctypedef unsigned char nvmlGpuFabricState_t 'nvmlGpuFabricState_t' +ctypedef struct nvmlSystemDriverBranchInfo_v1_t 'nvmlSystemDriverBranchInfo_v1_t': + unsigned int version + char branch[80] + +ctypedef unsigned int nvmlAffinityScope_t 'nvmlAffinityScope_t' +ctypedef struct nvmlTemperature_v1_t 'nvmlTemperature_v1_t': + unsigned int version + nvmlTemperatureSensors_t sensorType + int temperature + +ctypedef struct nvmlNvlinkSupportedBwModes_v1_t 'nvmlNvlinkSupportedBwModes_v1_t': + unsigned int version + unsigned char bwModes[23] + unsigned char totalBwModes + +ctypedef struct nvmlNvlinkGetBwMode_v1_t 'nvmlNvlinkGetBwMode_v1_t': + unsigned int version + unsigned int bIsBest + unsigned char bwMode + +ctypedef struct nvmlNvlinkSetBwMode_v1_t 'nvmlNvlinkSetBwMode_v1_t': + unsigned int version + unsigned int bSetBest + unsigned char bwMode + +ctypedef struct nvmlDeviceCapabilities_v1_t 'nvmlDeviceCapabilities_v1_t': + unsigned int version + unsigned int capMask + +ctypedef struct nvmlPowerSmoothingProfile_v1_t 'nvmlPowerSmoothingProfile_v1_t': + unsigned int version + unsigned int profileId + unsigned int paramId + double value + +ctypedef struct nvmlPowerSmoothingState_v1_t 'nvmlPowerSmoothingState_v1_t': + unsigned int version + nvmlEnableState_t state + +ctypedef struct nvmlDeviceAddressingMode_v1_t 'nvmlDeviceAddressingMode_v1_t': + unsigned int version + unsigned int value + +ctypedef struct nvmlRepairStatus_v1_t 'nvmlRepairStatus_v1_t': + unsigned int version + unsigned int bChannelRepairPending + unsigned int bTpcRepairPending + +ctypedef struct nvmlPdi_v1_t 'nvmlPdi_v1_t': + unsigned int version + unsigned long long value + +ctypedef void* nvmlDevice_t 'nvmlDevice_t' +ctypedef void* nvmlGpuInstance_t 'nvmlGpuInstance_t' +ctypedef void* nvmlUnit_t 'nvmlUnit_t' +ctypedef void* nvmlEventSet_t 'nvmlEventSet_t' +ctypedef void* nvmlSystemEventSet_t 'nvmlSystemEventSet_t' +ctypedef void* nvmlComputeInstance_t 'nvmlComputeInstance_t' +ctypedef void* nvmlGpmSample_t 'nvmlGpmSample_t' +ctypedef struct nvmlPciInfo_t 'nvmlPciInfo_t': + char busIdLegacy[16] + unsigned int domain + unsigned int bus + unsigned int device + unsigned int pciDeviceId + unsigned int pciSubSystemId + char busId[32] + +ctypedef struct nvmlEccErrorCounts_t 'nvmlEccErrorCounts_t': + unsigned long long l1Cache + unsigned long long l2Cache + unsigned long long deviceMemory + unsigned long long registerFile + +ctypedef struct nvmlUtilization_t 'nvmlUtilization_t': + unsigned int gpu + unsigned int memory + +ctypedef struct nvmlMemory_t 'nvmlMemory_t': + unsigned long long total + unsigned long long free + unsigned long long used + +ctypedef struct nvmlMemory_v2_t 'nvmlMemory_v2_t': + unsigned int version + unsigned long long total + unsigned long long reserved + unsigned long long free + unsigned long long used + +ctypedef struct nvmlBAR1Memory_t 'nvmlBAR1Memory_t': + unsigned long long bar1Total + unsigned long long bar1Free + unsigned long long bar1Used + +ctypedef struct nvmlProcessInfo_v1_t 'nvmlProcessInfo_v1_t': + unsigned int pid + unsigned long long usedGpuMemory + +ctypedef struct nvmlProcessInfo_v2_t 'nvmlProcessInfo_v2_t': + unsigned int pid + unsigned long long usedGpuMemory + unsigned int gpuInstanceId + unsigned int computeInstanceId + +ctypedef struct nvmlProcessInfo_t 'nvmlProcessInfo_t': + unsigned int pid + unsigned long long usedGpuMemory + unsigned int gpuInstanceId + unsigned int computeInstanceId + +ctypedef struct nvmlProcessDetail_v1_t 'nvmlProcessDetail_v1_t': + unsigned int pid + unsigned long long usedGpuMemory + unsigned int gpuInstanceId + unsigned int computeInstanceId + unsigned long long usedGpuCcProtectedMemory + +ctypedef struct nvmlDeviceAttributes_t 'nvmlDeviceAttributes_t': + unsigned int multiprocessorCount + unsigned int sharedCopyEngineCount + unsigned int sharedDecoderCount + unsigned int sharedEncoderCount + unsigned int sharedJpegCount + unsigned int sharedOfaCount + unsigned int gpuInstanceSliceCount + unsigned int computeInstanceSliceCount + unsigned long long memorySizeMB + +ctypedef struct nvmlC2cModeInfo_v1_t 'nvmlC2cModeInfo_v1_t': + unsigned int isC2cEnabled + +ctypedef struct nvmlRowRemapperHistogramValues_t 'nvmlRowRemapperHistogramValues_t': + unsigned int max + unsigned int high + unsigned int partial + unsigned int low + unsigned int none + +ctypedef struct nvmlNvLinkUtilizationControl_t 'nvmlNvLinkUtilizationControl_t': + nvmlNvLinkUtilizationCountUnits_t units + nvmlNvLinkUtilizationCountPktTypes_t pktfilter + +ctypedef struct nvmlBridgeChipInfo_t 'nvmlBridgeChipInfo_t': + nvmlBridgeChipType_t type + unsigned int fwVersion + +ctypedef union nvmlValue_t 'nvmlValue_t': + double dVal + int siVal + unsigned int uiVal + unsigned long ulVal + unsigned long long ullVal + signed long long sllVal + unsigned short usVal + +ctypedef struct nvmlViolationTime_t 'nvmlViolationTime_t': + unsigned long long referenceTime + unsigned long long violationTime + +ctypedef struct _anon_pod0 '_anon_pod0': + nvmlThermalController_t controller + int defaultMinTemp + int defaultMaxTemp + int currentTemp + nvmlThermalTarget_t target + +ctypedef union nvmlUUIDValue_t 'nvmlUUIDValue_t': + char str[41] + unsigned char bytes[16] + +ctypedef struct nvmlClkMonFaultInfo_t 'nvmlClkMonFaultInfo_t': + unsigned int clkApiDomain + unsigned int clkDomainFaultMask + +ctypedef struct nvmlProcessUtilizationSample_t 'nvmlProcessUtilizationSample_t': + unsigned int pid + unsigned long long timeStamp + unsigned int smUtil + unsigned int memUtil + unsigned int encUtil + unsigned int decUtil + +ctypedef struct nvmlProcessUtilizationInfo_v1_t 'nvmlProcessUtilizationInfo_v1_t': + unsigned long long timeStamp + unsigned int pid + unsigned int smUtil + unsigned int memUtil + unsigned int encUtil + unsigned int decUtil + unsigned int jpgUtil + unsigned int ofaUtil + +ctypedef struct nvmlPlatformInfo_v1_t 'nvmlPlatformInfo_v1_t': + unsigned int version + unsigned char ibGuid[16] + unsigned char rackGuid[16] + unsigned char chassisPhysicalSlotNumber + unsigned char computeSlotIndex + unsigned char nodeIndex + unsigned char peerType + unsigned char moduleId + +ctypedef struct _anon_pod1 '_anon_pod1': + unsigned int bIsPresent + unsigned int percentage + unsigned int incThreshold + unsigned int decThreshold + +ctypedef struct nvmlVgpuPlacementList_v1_t 'nvmlVgpuPlacementList_v1_t': + unsigned int version + unsigned int placementSize + unsigned int count + unsigned int* placementIds + +ctypedef struct _anon_pod2 '_anon_pod2': + unsigned int avgFactor + unsigned int timeslice + +ctypedef struct _anon_pod3 '_anon_pod3': + unsigned int timeslice + +ctypedef struct nvmlVgpuSchedulerLogEntry_t 'nvmlVgpuSchedulerLogEntry_t': + unsigned long long timestamp + unsigned long long timeRunTotal + unsigned long long timeRun + unsigned int swRunlistId + unsigned long long targetTimeSlice + unsigned long long cumulativePreemptionTime + +ctypedef struct _anon_pod4 '_anon_pod4': + unsigned int avgFactor + unsigned int frequency + +ctypedef struct _anon_pod5 '_anon_pod5': + unsigned int timeslice + +ctypedef struct nvmlVgpuSchedulerCapabilities_t 'nvmlVgpuSchedulerCapabilities_t': + unsigned int supportedSchedulers[3] + unsigned int maxTimeslice + unsigned int minTimeslice + unsigned int isArrModeSupported + unsigned int maxFrequencyForARR + unsigned int minFrequencyForARR + unsigned int maxAvgFactorForARR + unsigned int minAvgFactorForARR + +ctypedef struct nvmlVgpuLicenseExpiry_t 'nvmlVgpuLicenseExpiry_t': + unsigned int year + unsigned short month + unsigned short day + unsigned short hour + unsigned short min + unsigned short sec + unsigned char status + +ctypedef struct nvmlGridLicenseExpiry_t 'nvmlGridLicenseExpiry_t': + unsigned int year + unsigned short month + unsigned short day + unsigned short hour + unsigned short min + unsigned short sec + unsigned char status + +ctypedef struct nvmlNvLinkPowerThres_t 'nvmlNvLinkPowerThres_t': + unsigned int lowPwrThreshold + +ctypedef struct nvmlHwbcEntry_t 'nvmlHwbcEntry_t': + unsigned int hwbcId + char firmwareVersion[32] + +ctypedef struct nvmlLedState_t 'nvmlLedState_t': + char cause[256] + nvmlLedColor_t color + +ctypedef struct nvmlUnitInfo_t 'nvmlUnitInfo_t': + char name[96] + char id[96] + char serial[96] + char firmwareVersion[96] + +ctypedef struct nvmlPSUInfo_t 'nvmlPSUInfo_t': + char state[256] + unsigned int current + unsigned int voltage + unsigned int power + +ctypedef struct nvmlUnitFanInfo_t 'nvmlUnitFanInfo_t': + unsigned int speed + nvmlFanState_t state + +ctypedef struct nvmlSystemEventData_v1_t 'nvmlSystemEventData_v1_t': + unsigned long long eventType + unsigned int gpuId + +ctypedef struct nvmlAccountingStats_t 'nvmlAccountingStats_t': + unsigned int gpuUtilization + unsigned int memoryUtilization + unsigned long long maxMemoryUsage + unsigned long long time + unsigned long long startTime + unsigned int isRunning + unsigned int reserved[5] + +ctypedef struct nvmlFBCStats_t 'nvmlFBCStats_t': + unsigned int sessionsCount + unsigned int averageFPS + unsigned int averageLatency + +ctypedef struct nvmlConfComputeSystemCaps_t 'nvmlConfComputeSystemCaps_t': + unsigned int cpuCaps + unsigned int gpusCaps + +ctypedef struct nvmlConfComputeSystemState_t 'nvmlConfComputeSystemState_t': + unsigned int environment + unsigned int ccFeature + unsigned int devToolsMode + +ctypedef struct nvmlConfComputeMemSizeInfo_t 'nvmlConfComputeMemSizeInfo_t': + unsigned long long protectedMemSizeKib + unsigned long long unprotectedMemSizeKib + +ctypedef struct nvmlConfComputeGpuCertificate_t 'nvmlConfComputeGpuCertificate_t': + unsigned int certChainSize + unsigned int attestationCertChainSize + unsigned char certChain[0x1000] + unsigned char attestationCertChain[0x1400] + +ctypedef struct nvmlConfComputeGpuAttestationReport_t 'nvmlConfComputeGpuAttestationReport_t': + unsigned int isCecAttestationReportPresent + unsigned int attestationReportSize + unsigned int cecAttestationReportSize + unsigned char nonce[0x20] + unsigned char attestationReport[0x2000] + unsigned char cecAttestationReport[0x1000] + +ctypedef struct nvmlVgpuVersion_t 'nvmlVgpuVersion_t': + unsigned int minVersion + unsigned int maxVersion + +ctypedef struct nvmlVgpuMetadata_t 'nvmlVgpuMetadata_t': + unsigned int version + unsigned int revision + nvmlVgpuGuestInfoState_t guestInfoState + char guestDriverVersion[80] + char hostDriverVersion[80] + unsigned int reserved[6] + unsigned int vgpuVirtualizationCaps + unsigned int guestVgpuVersion + unsigned int opaqueDataSize + char opaqueData[4] + +ctypedef struct nvmlVgpuPgpuCompatibility_t 'nvmlVgpuPgpuCompatibility_t': + nvmlVgpuVmCompatibility_t vgpuVmCompatibility + nvmlVgpuPgpuCompatibilityLimitCode_t compatibilityLimitCode + +ctypedef struct nvmlGpuInstancePlacement_t 'nvmlGpuInstancePlacement_t': + unsigned int start + unsigned int size + +ctypedef struct nvmlGpuInstanceProfileInfo_t 'nvmlGpuInstanceProfileInfo_t': + unsigned int id + unsigned int isP2pSupported + unsigned int sliceCount + unsigned int instanceCount + unsigned int multiprocessorCount + unsigned int copyEngineCount + unsigned int decoderCount + unsigned int encoderCount + unsigned int jpegCount + unsigned int ofaCount + unsigned long long memorySizeMB + +ctypedef struct nvmlGpuInstanceProfileInfo_v2_t 'nvmlGpuInstanceProfileInfo_v2_t': + unsigned int version + unsigned int id + unsigned int isP2pSupported + unsigned int sliceCount + unsigned int instanceCount + unsigned int multiprocessorCount + unsigned int copyEngineCount + unsigned int decoderCount + unsigned int encoderCount + unsigned int jpegCount + unsigned int ofaCount + unsigned long long memorySizeMB + char name[96] + +ctypedef struct nvmlGpuInstanceProfileInfo_v3_t 'nvmlGpuInstanceProfileInfo_v3_t': + unsigned int version + unsigned int id + unsigned int sliceCount + unsigned int instanceCount + unsigned int multiprocessorCount + unsigned int copyEngineCount + unsigned int decoderCount + unsigned int encoderCount + unsigned int jpegCount + unsigned int ofaCount + unsigned long long memorySizeMB + char name[96] + unsigned int capabilities + +ctypedef struct nvmlComputeInstancePlacement_t 'nvmlComputeInstancePlacement_t': + unsigned int start + unsigned int size + +ctypedef struct nvmlComputeInstanceProfileInfo_t 'nvmlComputeInstanceProfileInfo_t': + unsigned int id + unsigned int sliceCount + unsigned int instanceCount + unsigned int multiprocessorCount + unsigned int sharedCopyEngineCount + unsigned int sharedDecoderCount + unsigned int sharedEncoderCount + unsigned int sharedJpegCount + unsigned int sharedOfaCount + +ctypedef struct nvmlComputeInstanceProfileInfo_v2_t 'nvmlComputeInstanceProfileInfo_v2_t': + unsigned int version + unsigned int id + unsigned int sliceCount + unsigned int instanceCount + unsigned int multiprocessorCount + unsigned int sharedCopyEngineCount + unsigned int sharedDecoderCount + unsigned int sharedEncoderCount + unsigned int sharedJpegCount + unsigned int sharedOfaCount + char name[96] + +ctypedef struct nvmlComputeInstanceProfileInfo_v3_t 'nvmlComputeInstanceProfileInfo_v3_t': + unsigned int version + unsigned int id + unsigned int sliceCount + unsigned int instanceCount + unsigned int multiprocessorCount + unsigned int sharedCopyEngineCount + unsigned int sharedDecoderCount + unsigned int sharedEncoderCount + unsigned int sharedJpegCount + unsigned int sharedOfaCount + char name[96] + unsigned int capabilities + +ctypedef struct _anon_pod6 '_anon_pod6': + char* shortName + char* longName + char* unit + +ctypedef struct nvmlGpmSupport_t 'nvmlGpmSupport_t': + unsigned int version + unsigned int isSupportedDevice + +ctypedef struct nvmlMask255_t 'nvmlMask255_t': + unsigned int mask[8] + +ctypedef struct nvmlDevicePowerMizerModes_v1_t 'nvmlDevicePowerMizerModes_v1_t': + unsigned int currentMode + unsigned int mode + unsigned int supportedPowerMizerModes + +ctypedef struct nvmlHostname_v1_t 'nvmlHostname_v1_t': + char value[64] + +ctypedef struct nvmlEccSramUniqueUncorrectedErrorEntry_v1_t 'nvmlEccSramUniqueUncorrectedErrorEntry_v1_t': + unsigned int unit + unsigned int location + unsigned int sublocation + unsigned int extlocation + unsigned int address + unsigned int isParity + unsigned int count + +ctypedef struct nvmlNvLinkInfo_v1_t 'nvmlNvLinkInfo_v1_t': + unsigned int version + unsigned int isNvleEnabled + +ctypedef struct nvmlNvlinkFirmwareVersion_t 'nvmlNvlinkFirmwareVersion_t': + unsigned char ucodeType + unsigned int major + unsigned int minor + unsigned int subMinor + +ctypedef union _anon_pod7 '_anon_pod7': + unsigned char inData[496] + unsigned char outData[496] + +ctypedef nvmlPciInfoExt_v1_t nvmlPciInfoExt_t 'nvmlPciInfoExt_t' +ctypedef nvmlCoolerInfo_v1_t nvmlCoolerInfo_t 'nvmlCoolerInfo_t' +ctypedef nvmlDramEncryptionInfo_v1_t nvmlDramEncryptionInfo_t 'nvmlDramEncryptionInfo_t' +ctypedef nvmlMarginTemperature_v1_t nvmlMarginTemperature_t 'nvmlMarginTemperature_t' +ctypedef nvmlClockOffset_v1_t nvmlClockOffset_t 'nvmlClockOffset_t' +ctypedef nvmlFanSpeedInfo_v1_t nvmlFanSpeedInfo_t 'nvmlFanSpeedInfo_t' +ctypedef nvmlDevicePerfModes_v1_t nvmlDevicePerfModes_t 'nvmlDevicePerfModes_t' +ctypedef nvmlDeviceCurrentClockFreqs_v1_t nvmlDeviceCurrentClockFreqs_t 'nvmlDeviceCurrentClockFreqs_t' +ctypedef nvmlEccSramErrorStatus_v1_t nvmlEccSramErrorStatus_t 'nvmlEccSramErrorStatus_t' +ctypedef nvmlPlatformInfo_v2_t nvmlPlatformInfo_t 'nvmlPlatformInfo_t' +ctypedef struct nvmlPowerValue_v2_t 'nvmlPowerValue_v2_t': + unsigned int version + nvmlPowerScopeType_t powerScope + unsigned int powerValueMw + +ctypedef struct nvmlVgpuTypeIdInfo_v1_t 'nvmlVgpuTypeIdInfo_v1_t': + unsigned int version + unsigned int vgpuCount + nvmlVgpuTypeId_t* vgpuTypeIds + +ctypedef struct nvmlVgpuTypeMaxInstance_v1_t 'nvmlVgpuTypeMaxInstance_v1_t': + unsigned int version + nvmlVgpuTypeId_t vgpuTypeId + unsigned int maxInstancePerGI + +ctypedef struct nvmlVgpuCreatablePlacementInfo_v1_t 'nvmlVgpuCreatablePlacementInfo_v1_t': + unsigned int version + nvmlVgpuTypeId_t vgpuTypeId + unsigned int count + unsigned int* placementIds + unsigned int placementSize + +ctypedef struct nvmlVgpuProcessUtilizationSample_t 'nvmlVgpuProcessUtilizationSample_t': + nvmlVgpuInstance_t vgpuInstance + unsigned int pid + char processName[64] + unsigned long long timeStamp + unsigned int smUtil + unsigned int memUtil + unsigned int encUtil + unsigned int decUtil + +ctypedef struct nvmlVgpuProcessUtilizationInfo_v1_t 'nvmlVgpuProcessUtilizationInfo_v1_t': + char processName[64] + unsigned long long timeStamp + nvmlVgpuInstance_t vgpuInstance + unsigned int pid + unsigned int smUtil + unsigned int memUtil + unsigned int encUtil + unsigned int decUtil + unsigned int jpgUtil + unsigned int ofaUtil + +ctypedef struct nvmlActiveVgpuInstanceInfo_v1_t 'nvmlActiveVgpuInstanceInfo_v1_t': + unsigned int version + unsigned int vgpuCount + nvmlVgpuInstance_t* vgpuInstances + +ctypedef struct nvmlEncoderSessionInfo_t 'nvmlEncoderSessionInfo_t': + unsigned int sessionId + unsigned int pid + nvmlVgpuInstance_t vgpuInstance + nvmlEncoderType_t codecType + unsigned int hResolution + unsigned int vResolution + unsigned int averageFps + unsigned int averageLatency + +ctypedef struct nvmlFBCSessionInfo_t 'nvmlFBCSessionInfo_t': + unsigned int sessionId + unsigned int pid + nvmlVgpuInstance_t vgpuInstance + unsigned int displayOrdinal + nvmlFBCSessionType_t sessionType + unsigned int sessionFlags + unsigned int hMaxResolution + unsigned int vMaxResolution + unsigned int hResolution + unsigned int vResolution + unsigned int averageFPS + unsigned int averageLatency + +ctypedef nvmlVgpuHeterogeneousMode_v1_t nvmlVgpuHeterogeneousMode_t 'nvmlVgpuHeterogeneousMode_t' +ctypedef nvmlVgpuPlacementId_v1_t nvmlVgpuPlacementId_t 'nvmlVgpuPlacementId_t' +ctypedef nvmlVgpuPlacementList_v2_t nvmlVgpuPlacementList_t 'nvmlVgpuPlacementList_t' +ctypedef nvmlVgpuTypeBar1Info_v1_t nvmlVgpuTypeBar1Info_t 'nvmlVgpuTypeBar1Info_t' +ctypedef nvmlVgpuRuntimeState_v1_t nvmlVgpuRuntimeState_t 'nvmlVgpuRuntimeState_t' +ctypedef nvmlSystemConfComputeSettings_v1_t nvmlSystemConfComputeSettings_t 'nvmlSystemConfComputeSettings_t' +ctypedef nvmlConfComputeSetKeyRotationThresholdInfo_v1_t nvmlConfComputeSetKeyRotationThresholdInfo_t 'nvmlConfComputeSetKeyRotationThresholdInfo_t' +ctypedef nvmlConfComputeGetKeyRotationThresholdInfo_v1_t nvmlConfComputeGetKeyRotationThresholdInfo_t 'nvmlConfComputeGetKeyRotationThresholdInfo_t' +ctypedef struct nvmlGpuFabricInfo_t 'nvmlGpuFabricInfo_t': + unsigned char clusterUuid[16] + nvmlReturn_t status + unsigned int cliqueId + nvmlGpuFabricState_t state + +ctypedef struct nvmlGpuFabricInfo_v2_t 'nvmlGpuFabricInfo_v2_t': + unsigned int version + unsigned char clusterUuid[16] + nvmlReturn_t status + unsigned int cliqueId + nvmlGpuFabricState_t state + unsigned int healthMask + +ctypedef struct nvmlGpuFabricInfo_v3_t 'nvmlGpuFabricInfo_v3_t': + unsigned int version + unsigned char clusterUuid[16] + nvmlReturn_t status + unsigned int cliqueId + nvmlGpuFabricState_t state + unsigned int healthMask + unsigned char healthSummary + +ctypedef nvmlSystemDriverBranchInfo_v1_t nvmlSystemDriverBranchInfo_t 'nvmlSystemDriverBranchInfo_t' +ctypedef nvmlTemperature_v1_t nvmlTemperature_t 'nvmlTemperature_t' +ctypedef nvmlNvlinkSupportedBwModes_v1_t nvmlNvlinkSupportedBwModes_t 'nvmlNvlinkSupportedBwModes_t' +ctypedef nvmlNvlinkGetBwMode_v1_t nvmlNvlinkGetBwMode_t 'nvmlNvlinkGetBwMode_t' +ctypedef nvmlNvlinkSetBwMode_v1_t nvmlNvlinkSetBwMode_t 'nvmlNvlinkSetBwMode_t' +ctypedef nvmlDeviceCapabilities_v1_t nvmlDeviceCapabilities_t 'nvmlDeviceCapabilities_t' +ctypedef nvmlPowerSmoothingProfile_v1_t nvmlPowerSmoothingProfile_t 'nvmlPowerSmoothingProfile_t' +ctypedef nvmlPowerSmoothingState_v1_t nvmlPowerSmoothingState_t 'nvmlPowerSmoothingState_t' +ctypedef nvmlDeviceAddressingMode_v1_t nvmlDeviceAddressingMode_t 'nvmlDeviceAddressingMode_t' +ctypedef nvmlRepairStatus_v1_t nvmlRepairStatus_t 'nvmlRepairStatus_t' +ctypedef nvmlPdi_v1_t nvmlPdi_t 'nvmlPdi_t' +ctypedef struct nvmlEventData_t 'nvmlEventData_t': + nvmlDevice_t device + unsigned long long eventType + unsigned long long eventData + unsigned int gpuInstanceId + unsigned int computeInstanceId + +ctypedef struct nvmlSystemEventSetCreateRequest_v1_t 'nvmlSystemEventSetCreateRequest_v1_t': + unsigned int version + nvmlSystemEventSet_t set + +ctypedef struct nvmlSystemEventSetFreeRequest_v1_t 'nvmlSystemEventSetFreeRequest_v1_t': + unsigned int version + nvmlSystemEventSet_t set + +ctypedef struct nvmlSystemRegisterEventRequest_v1_t 'nvmlSystemRegisterEventRequest_v1_t': + unsigned int version + unsigned long long eventTypes + nvmlSystemEventSet_t set + +ctypedef struct nvmlExcludedDeviceInfo_t 'nvmlExcludedDeviceInfo_t': + nvmlPciInfo_t pciInfo + char uuid[80] + +ctypedef struct nvmlProcessDetailList_v1_t 'nvmlProcessDetailList_v1_t': + unsigned int version + unsigned int mode + unsigned int numProcArrayEntries + nvmlProcessDetail_v1_t* procArray + +ctypedef struct nvmlBridgeChipHierarchy_t 'nvmlBridgeChipHierarchy_t': + unsigned char bridgeCount + nvmlBridgeChipInfo_t bridgeChipInfo[128] + +ctypedef struct nvmlSample_t 'nvmlSample_t': + unsigned long long timeStamp + nvmlValue_t sampleValue + +ctypedef struct nvmlVgpuInstanceUtilizationSample_t 'nvmlVgpuInstanceUtilizationSample_t': + nvmlVgpuInstance_t vgpuInstance + unsigned long long timeStamp + nvmlValue_t smUtil + nvmlValue_t memUtil + nvmlValue_t encUtil + nvmlValue_t decUtil + +ctypedef struct nvmlVgpuInstanceUtilizationInfo_v1_t 'nvmlVgpuInstanceUtilizationInfo_v1_t': + unsigned long long timeStamp + nvmlVgpuInstance_t vgpuInstance + nvmlValue_t smUtil + nvmlValue_t memUtil + nvmlValue_t encUtil + nvmlValue_t decUtil + nvmlValue_t jpgUtil + nvmlValue_t ofaUtil + +ctypedef struct nvmlFieldValue_t 'nvmlFieldValue_t': + unsigned int fieldId + unsigned int scopeId + long long timestamp + long long latencyUsec + nvmlValueType_t valueType + nvmlReturn_t nvmlReturn + nvmlValue_t value + +ctypedef struct nvmlGpuThermalSettings_t 'nvmlGpuThermalSettings_t': + unsigned int count + _anon_pod0 sensor[3] + +ctypedef struct nvmlUUID_v1_t 'nvmlUUID_v1_t': + unsigned int version + unsigned int type + nvmlUUIDValue_t value + +ctypedef struct nvmlClkMonStatus_t 'nvmlClkMonStatus_t': + unsigned int bGlobalStatus + unsigned int clkMonListSize + nvmlClkMonFaultInfo_t clkMonList[32] + +ctypedef struct nvmlProcessesUtilizationInfo_v1_t 'nvmlProcessesUtilizationInfo_v1_t': + unsigned int version + unsigned int processSamplesCount + unsigned long long lastSeenTimeStamp + nvmlProcessUtilizationInfo_v1_t* procUtilArray + +ctypedef struct nvmlGpuDynamicPstatesInfo_t 'nvmlGpuDynamicPstatesInfo_t': + unsigned int flags + _anon_pod1 utilization[8] + +ctypedef union nvmlVgpuSchedulerParams_t 'nvmlVgpuSchedulerParams_t': + _anon_pod2 vgpuSchedDataWithARR + _anon_pod3 vgpuSchedData + +ctypedef union nvmlVgpuSchedulerSetParams_t 'nvmlVgpuSchedulerSetParams_t': + _anon_pod4 vgpuSchedDataWithARR + _anon_pod5 vgpuSchedData + +ctypedef struct nvmlVgpuLicenseInfo_t 'nvmlVgpuLicenseInfo_t': + unsigned char isLicensed + nvmlVgpuLicenseExpiry_t licenseExpiry + unsigned int currentState + +ctypedef struct nvmlGridLicensableFeature_t 'nvmlGridLicensableFeature_t': + nvmlGridLicenseFeatureCode_t featureCode + unsigned int featureState + char licenseInfo[128] + char productName[128] + unsigned int featureEnabled + nvmlGridLicenseExpiry_t licenseExpiry + +ctypedef struct nvmlUnitFanSpeeds_t 'nvmlUnitFanSpeeds_t': + nvmlUnitFanInfo_t fans[24] + unsigned int count + +ctypedef struct nvmlSystemEventSetWaitRequest_v1_t 'nvmlSystemEventSetWaitRequest_v1_t': + unsigned int version + unsigned int timeoutms + nvmlSystemEventSet_t set + nvmlSystemEventData_v1_t* data + unsigned int dataSize + unsigned int numEvent + +ctypedef struct nvmlVgpuPgpuMetadata_t 'nvmlVgpuPgpuMetadata_t': + unsigned int version + unsigned int revision + char hostDriverVersion[80] + unsigned int pgpuVirtualizationCaps + unsigned int reserved[5] + nvmlVgpuVersion_t hostSupportedVgpuRange + unsigned int opaqueDataSize + char opaqueData[4] + +ctypedef struct nvmlGpuInstanceInfo_t 'nvmlGpuInstanceInfo_t': + nvmlDevice_t device + unsigned int id + unsigned int profileId + nvmlGpuInstancePlacement_t placement + +ctypedef struct nvmlComputeInstanceInfo_t 'nvmlComputeInstanceInfo_t': + nvmlDevice_t device + nvmlGpuInstance_t gpuInstance + unsigned int id + unsigned int profileId + nvmlComputeInstancePlacement_t placement + +ctypedef struct nvmlGpmMetric_t 'nvmlGpmMetric_t': + unsigned int metricId + nvmlReturn_t nvmlReturn + double value + _anon_pod6 metricInfo + +ctypedef struct nvmlWorkloadPowerProfileInfo_v1_t 'nvmlWorkloadPowerProfileInfo_v1_t': + unsigned int version + unsigned int profileId + unsigned int priority + nvmlMask255_t conflictingMask + +ctypedef struct nvmlWorkloadPowerProfileCurrentProfiles_v1_t 'nvmlWorkloadPowerProfileCurrentProfiles_v1_t': + unsigned int version + nvmlMask255_t perfProfilesMask + nvmlMask255_t requestedProfilesMask + nvmlMask255_t enforcedProfilesMask + +ctypedef struct nvmlWorkloadPowerProfileRequestedProfiles_v1_t 'nvmlWorkloadPowerProfileRequestedProfiles_v1_t': + unsigned int version + nvmlMask255_t requestedProfilesMask + +ctypedef struct nvmlEccSramUniqueUncorrectedErrorCounts_v1_t 'nvmlEccSramUniqueUncorrectedErrorCounts_v1_t': + unsigned int version + unsigned int entryCount + nvmlEccSramUniqueUncorrectedErrorEntry_v1_t* entries + +ctypedef struct nvmlNvlinkFirmwareInfo_t 'nvmlNvlinkFirmwareInfo_t': + nvmlNvlinkFirmwareVersion_t firmwareVersion[100] + unsigned int numValidEntries + +ctypedef struct nvmlPRMTLV_v1_t 'nvmlPRMTLV_v1_t': + unsigned dataSize + unsigned status + _anon_pod7 _anon_pod_member0 + +ctypedef nvmlVgpuTypeIdInfo_v1_t nvmlVgpuTypeIdInfo_t 'nvmlVgpuTypeIdInfo_t' +ctypedef nvmlVgpuTypeMaxInstance_v1_t nvmlVgpuTypeMaxInstance_t 'nvmlVgpuTypeMaxInstance_t' +ctypedef nvmlVgpuCreatablePlacementInfo_v1_t nvmlVgpuCreatablePlacementInfo_t 'nvmlVgpuCreatablePlacementInfo_t' +ctypedef struct nvmlVgpuProcessesUtilizationInfo_v1_t 'nvmlVgpuProcessesUtilizationInfo_v1_t': + unsigned int version + unsigned int vgpuProcessCount + unsigned long long lastSeenTimeStamp + nvmlVgpuProcessUtilizationInfo_v1_t* vgpuProcUtilArray + +ctypedef nvmlActiveVgpuInstanceInfo_v1_t nvmlActiveVgpuInstanceInfo_t 'nvmlActiveVgpuInstanceInfo_t' +ctypedef nvmlGpuFabricInfo_v3_t nvmlGpuFabricInfoV_t 'nvmlGpuFabricInfoV_t' +ctypedef nvmlSystemEventSetCreateRequest_v1_t nvmlSystemEventSetCreateRequest_t 'nvmlSystemEventSetCreateRequest_t' +ctypedef nvmlSystemEventSetFreeRequest_v1_t nvmlSystemEventSetFreeRequest_t 'nvmlSystemEventSetFreeRequest_t' +ctypedef nvmlSystemRegisterEventRequest_v1_t nvmlSystemRegisterEventRequest_t 'nvmlSystemRegisterEventRequest_t' +ctypedef nvmlProcessDetailList_v1_t nvmlProcessDetailList_t 'nvmlProcessDetailList_t' +ctypedef struct nvmlVgpuInstancesUtilizationInfo_v1_t 'nvmlVgpuInstancesUtilizationInfo_v1_t': + unsigned int version + nvmlValueType_t sampleValType + unsigned int vgpuInstanceCount + unsigned long long lastSeenTimeStamp + nvmlVgpuInstanceUtilizationInfo_v1_t* vgpuUtilArray + +ctypedef nvmlUUID_v1_t nvmlUUID_t 'nvmlUUID_t' +ctypedef nvmlProcessesUtilizationInfo_v1_t nvmlProcessesUtilizationInfo_t 'nvmlProcessesUtilizationInfo_t' +ctypedef struct nvmlVgpuSchedulerLog_t 'nvmlVgpuSchedulerLog_t': + unsigned int engineId + unsigned int schedulerPolicy + unsigned int arrMode + nvmlVgpuSchedulerParams_t schedulerParams + unsigned int entriesCount + nvmlVgpuSchedulerLogEntry_t logEntries[200] + +ctypedef struct nvmlVgpuSchedulerGetState_t 'nvmlVgpuSchedulerGetState_t': + unsigned int schedulerPolicy + unsigned int arrMode + nvmlVgpuSchedulerParams_t schedulerParams + +ctypedef struct nvmlVgpuSchedulerStateInfo_v1_t 'nvmlVgpuSchedulerStateInfo_v1_t': + unsigned int version + unsigned int engineId + unsigned int schedulerPolicy + unsigned int arrMode + nvmlVgpuSchedulerParams_t schedulerParams + +ctypedef struct nvmlVgpuSchedulerLogInfo_v1_t 'nvmlVgpuSchedulerLogInfo_v1_t': + unsigned int version + unsigned int engineId + unsigned int schedulerPolicy + unsigned int arrMode + nvmlVgpuSchedulerParams_t schedulerParams + unsigned int entriesCount + nvmlVgpuSchedulerLogEntry_t logEntries[200] + +ctypedef struct nvmlVgpuSchedulerSetState_t 'nvmlVgpuSchedulerSetState_t': + unsigned int schedulerPolicy + unsigned int enableARRMode + nvmlVgpuSchedulerSetParams_t schedulerParams + +ctypedef struct nvmlVgpuSchedulerState_v1_t 'nvmlVgpuSchedulerState_v1_t': + unsigned int version + unsigned int engineId + unsigned int schedulerPolicy + unsigned int enableARRMode + nvmlVgpuSchedulerSetParams_t schedulerParams + +ctypedef struct nvmlGridLicensableFeatures_t 'nvmlGridLicensableFeatures_t': + int isGridLicenseSupported + unsigned int licensableFeaturesCount + nvmlGridLicensableFeature_t gridLicensableFeatures[3] + +ctypedef nvmlSystemEventSetWaitRequest_v1_t nvmlSystemEventSetWaitRequest_t 'nvmlSystemEventSetWaitRequest_t' +ctypedef struct nvmlGpmMetricsGet_t 'nvmlGpmMetricsGet_t': + unsigned int version + unsigned int numMetrics + nvmlGpmSample_t sample1 + nvmlGpmSample_t sample2 + nvmlGpmMetric_t metrics[210] + +ctypedef nvmlWorkloadPowerProfileInfo_v1_t nvmlWorkloadPowerProfileInfo_t 'nvmlWorkloadPowerProfileInfo_t' +ctypedef nvmlWorkloadPowerProfileCurrentProfiles_v1_t nvmlWorkloadPowerProfileCurrentProfiles_t 'nvmlWorkloadPowerProfileCurrentProfiles_t' +ctypedef nvmlWorkloadPowerProfileRequestedProfiles_v1_t nvmlWorkloadPowerProfileRequestedProfiles_t 'nvmlWorkloadPowerProfileRequestedProfiles_t' +ctypedef nvmlEccSramUniqueUncorrectedErrorCounts_v1_t nvmlEccSramUniqueUncorrectedErrorCounts_t 'nvmlEccSramUniqueUncorrectedErrorCounts_t' +ctypedef struct nvmlNvLinkInfo_v2_t 'nvmlNvLinkInfo_v2_t': + unsigned int version + unsigned int isNvleEnabled + nvmlNvlinkFirmwareInfo_t firmwareInfo + +ctypedef nvmlVgpuProcessesUtilizationInfo_v1_t nvmlVgpuProcessesUtilizationInfo_t 'nvmlVgpuProcessesUtilizationInfo_t' +ctypedef nvmlVgpuInstancesUtilizationInfo_v1_t nvmlVgpuInstancesUtilizationInfo_t 'nvmlVgpuInstancesUtilizationInfo_t' +ctypedef nvmlVgpuSchedulerStateInfo_v1_t nvmlVgpuSchedulerStateInfo_t 'nvmlVgpuSchedulerStateInfo_t' +ctypedef nvmlVgpuSchedulerLogInfo_v1_t nvmlVgpuSchedulerLogInfo_t 'nvmlVgpuSchedulerLogInfo_t' +ctypedef nvmlVgpuSchedulerState_v1_t nvmlVgpuSchedulerState_t 'nvmlVgpuSchedulerState_t' +ctypedef struct nvmlWorkloadPowerProfileProfilesInfo_v1_t 'nvmlWorkloadPowerProfileProfilesInfo_v1_t': + unsigned int version + nvmlMask255_t perfProfilesMask + nvmlWorkloadPowerProfileInfo_t perfProfile[255] + +ctypedef nvmlNvLinkInfo_v2_t nvmlNvLinkInfo_t 'nvmlNvLinkInfo_t' +ctypedef nvmlWorkloadPowerProfileProfilesInfo_v1_t nvmlWorkloadPowerProfileProfilesInfo_t 'nvmlWorkloadPowerProfileProfilesInfo_t' + + +############################################################################### +# Functions +############################################################################### + +cdef nvmlReturn_t nvmlInit_v2() except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlInitWithFlags(unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlShutdown() except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef const char* nvmlErrorString(nvmlReturn_t result) except?NULL nogil +cdef nvmlReturn_t nvmlSystemGetDriverVersion(char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetNVMLVersion(char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetCudaDriverVersion(int* cudaDriverVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetCudaDriverVersion_v2(int* cudaDriverVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetProcessName(unsigned int pid, char* name, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetHicVersion(unsigned int* hwbcCount, nvmlHwbcEntry_t* hwbcEntries) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetTopologyGpuSet(unsigned int cpuNumber, unsigned int* count, nvmlDevice_t* deviceArray) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetDriverBranch(nvmlSystemDriverBranchInfo_t* branchInfo, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlUnitGetCount(unsigned int* unitCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlUnitGetHandleByIndex(unsigned int index, nvmlUnit_t* unit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlUnitGetUnitInfo(nvmlUnit_t unit, nvmlUnitInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlUnitGetLedState(nvmlUnit_t unit, nvmlLedState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlUnitGetPsuInfo(nvmlUnit_t unit, nvmlPSUInfo_t* psu) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlUnitGetTemperature(nvmlUnit_t unit, unsigned int type, unsigned int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlUnitGetFanSpeedInfo(nvmlUnit_t unit, nvmlUnitFanSpeeds_t* fanSpeeds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlUnitGetDevices(nvmlUnit_t unit, unsigned int* deviceCount, nvmlDevice_t* devices) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCount_v2(unsigned int* deviceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetAttributes_v2(nvmlDevice_t device, nvmlDeviceAttributes_t* attributes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetHandleByIndex_v2(unsigned int index, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetHandleBySerial(const char* serial, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetHandleByUUID(const char* uuid, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetHandleByUUIDV(const nvmlUUID_t* uuid, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetHandleByPciBusId_v2(const char* pciBusId, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetName(nvmlDevice_t device, char* name, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetBrand(nvmlDevice_t device, nvmlBrandType_t* type) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetIndex(nvmlDevice_t device, unsigned int* index) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetSerial(nvmlDevice_t device, char* serial, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetModuleId(nvmlDevice_t device, unsigned int* moduleId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetC2cModeInfoV(nvmlDevice_t device, nvmlC2cModeInfo_v1_t* c2cModeInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMemoryAffinity(nvmlDevice_t device, unsigned int nodeSetSize, unsigned long* nodeSet, nvmlAffinityScope_t scope) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCpuAffinityWithinScope(nvmlDevice_t device, unsigned int cpuSetSize, unsigned long* cpuSet, nvmlAffinityScope_t scope) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCpuAffinity(nvmlDevice_t device, unsigned int cpuSetSize, unsigned long* cpuSet) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetCpuAffinity(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceClearCpuAffinity(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNumaNodeId(nvmlDevice_t device, unsigned int* node) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetTopologyCommonAncestor(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuTopologyLevel_t* pathInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetTopologyNearestGpus(nvmlDevice_t device, nvmlGpuTopologyLevel_t level, unsigned int* count, nvmlDevice_t* deviceArray) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetP2PStatus(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuP2PCapsIndex_t p2pIndex, nvmlGpuP2PStatus_t* p2pStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetUUID(nvmlDevice_t device, char* uuid, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMinorNumber(nvmlDevice_t device, unsigned int* minorNumber) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetBoardPartNumber(nvmlDevice_t device, char* partNumber, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetInforomVersion(nvmlDevice_t device, nvmlInforomObject_t object, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetInforomImageVersion(nvmlDevice_t device, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetInforomConfigurationChecksum(nvmlDevice_t device, unsigned int* checksum) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceValidateInforom(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetLastBBXFlushTime(nvmlDevice_t device, unsigned long long* timestamp, unsigned long* durationUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetDisplayMode(nvmlDevice_t device, nvmlEnableState_t* display) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetDisplayActive(nvmlDevice_t device, nvmlEnableState_t* isActive) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPciInfoExt(nvmlDevice_t device, nvmlPciInfoExt_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPciInfo_v3(nvmlDevice_t device, nvmlPciInfo_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMaxPcieLinkGeneration(nvmlDevice_t device, unsigned int* maxLinkGen) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpuMaxPcieLinkGeneration(nvmlDevice_t device, unsigned int* maxLinkGenDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMaxPcieLinkWidth(nvmlDevice_t device, unsigned int* maxLinkWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCurrPcieLinkGeneration(nvmlDevice_t device, unsigned int* currLinkGen) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCurrPcieLinkWidth(nvmlDevice_t device, unsigned int* currLinkWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPcieThroughput(nvmlDevice_t device, nvmlPcieUtilCounter_t counter, unsigned int* value) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPcieReplayCounter(nvmlDevice_t device, unsigned int* value) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMaxClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpcClkVfOffset(nvmlDevice_t device, int* offset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetClock(nvmlDevice_t device, nvmlClockType_t clockType, nvmlClockId_t clockId, unsigned int* clockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMaxCustomerBoostClock(nvmlDevice_t device, nvmlClockType_t clockType, unsigned int* clockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetSupportedMemoryClocks(nvmlDevice_t device, unsigned int* count, unsigned int* clocksMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetSupportedGraphicsClocks(nvmlDevice_t device, unsigned int memoryClockMHz, unsigned int* count, unsigned int* clocksMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t* isEnabled, nvmlEnableState_t* defaultIsEnabled) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetFanSpeed(nvmlDevice_t device, unsigned int* speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetFanSpeed_v2(nvmlDevice_t device, unsigned int fan, unsigned int* speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetFanSpeedRPM(nvmlDevice_t device, nvmlFanSpeedInfo_t* fanSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetTargetFanSpeed(nvmlDevice_t device, unsigned int fan, unsigned int* targetSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMinMaxFanSpeed(nvmlDevice_t device, unsigned int* minSpeed, unsigned int* maxSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetFanControlPolicy_v2(nvmlDevice_t device, unsigned int fan, nvmlFanControlPolicy_t* policy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNumFans(nvmlDevice_t device, unsigned int* numFans) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCoolerInfo(nvmlDevice_t device, nvmlCoolerInfo_t* coolerInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetTemperatureV(nvmlDevice_t device, nvmlTemperature_t* temperature) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetTemperatureThreshold(nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, unsigned int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMarginTemperature(nvmlDevice_t device, nvmlMarginTemperature_t* marginTempInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetThermalSettings(nvmlDevice_t device, unsigned int sensorIndex, nvmlGpuThermalSettings_t* pThermalSettings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPerformanceState(nvmlDevice_t device, nvmlPstates_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCurrentClocksEventReasons(nvmlDevice_t device, unsigned long long* clocksEventReasons) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetSupportedClocksEventReasons(nvmlDevice_t device, unsigned long long* supportedClocksEventReasons) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPowerState(nvmlDevice_t device, nvmlPstates_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetDynamicPstatesInfo(nvmlDevice_t device, nvmlGpuDynamicPstatesInfo_t* pDynamicPstatesInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMemClkVfOffset(nvmlDevice_t device, int* offset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMinMaxClockOfPState(nvmlDevice_t device, nvmlClockType_t type, nvmlPstates_t pstate, unsigned int* minClockMHz, unsigned int* maxClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetSupportedPerformanceStates(nvmlDevice_t device, nvmlPstates_t* pstates, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpcClkMinMaxVfOffset(nvmlDevice_t device, int* minOffset, int* maxOffset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMemClkMinMaxVfOffset(nvmlDevice_t device, int* minOffset, int* maxOffset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetClockOffsets(nvmlDevice_t device, nvmlClockOffset_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetClockOffsets(nvmlDevice_t device, nvmlClockOffset_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPerformanceModes(nvmlDevice_t device, nvmlDevicePerfModes_t* perfModes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCurrentClockFreqs(nvmlDevice_t device, nvmlDeviceCurrentClockFreqs_t* currentClockFreqs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPowerManagementLimit(nvmlDevice_t device, unsigned int* limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPowerManagementLimitConstraints(nvmlDevice_t device, unsigned int* minLimit, unsigned int* maxLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPowerManagementDefaultLimit(nvmlDevice_t device, unsigned int* defaultLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPowerUsage(nvmlDevice_t device, unsigned int* power) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetTotalEnergyConsumption(nvmlDevice_t device, unsigned long long* energy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetEnforcedPowerLimit(nvmlDevice_t device, unsigned int* limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t* current, nvmlGpuOperationMode_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMemoryInfo_v2(nvmlDevice_t device, nvmlMemory_v2_t* memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetComputeMode(nvmlDevice_t device, nvmlComputeMode_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCudaComputeCapability(nvmlDevice_t device, int* major, int* minor) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetDramEncryptionMode(nvmlDevice_t device, nvmlDramEncryptionInfo_t* current, nvmlDramEncryptionInfo_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetDramEncryptionMode(nvmlDevice_t device, const nvmlDramEncryptionInfo_t* dramEncryption) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetEccMode(nvmlDevice_t device, nvmlEnableState_t* current, nvmlEnableState_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetDefaultEccMode(nvmlDevice_t device, nvmlEnableState_t* defaultMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetBoardId(nvmlDevice_t device, unsigned int* boardId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMultiGpuBoard(nvmlDevice_t device, unsigned int* multiGpuBool) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetTotalEccErrors(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, unsigned long long* eccCounts) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMemoryErrorCounter(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, nvmlMemoryLocation_t locationType, unsigned long long* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetUtilizationRates(nvmlDevice_t device, nvmlUtilization_t* utilization) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetEncoderUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetEncoderCapacity(nvmlDevice_t device, nvmlEncoderType_t encoderQueryType, unsigned int* encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetEncoderStats(nvmlDevice_t device, unsigned int* sessionCount, unsigned int* averageFps, unsigned int* averageLatency) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetEncoderSessions(nvmlDevice_t device, unsigned int* sessionCount, nvmlEncoderSessionInfo_t* sessionInfos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetDecoderUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetJpgUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetOfaUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetFBCStats(nvmlDevice_t device, nvmlFBCStats_t* fbcStats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetFBCSessions(nvmlDevice_t device, unsigned int* sessionCount, nvmlFBCSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetDriverModel_v2(nvmlDevice_t device, nvmlDriverModel_t* current, nvmlDriverModel_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVbiosVersion(nvmlDevice_t device, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetBridgeChipInfo(nvmlDevice_t device, nvmlBridgeChipHierarchy_t* bridgeHierarchy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetComputeRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGraphicsRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMPSComputeRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetRunningProcessDetailList(nvmlDevice_t device, nvmlProcessDetailList_t* plist) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceOnSameBoard(nvmlDevice_t device1, nvmlDevice_t device2, int* onSameBoard) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t* isRestricted) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetSamples(nvmlDevice_t device, nvmlSamplingType_t type, unsigned long long lastSeenTimeStamp, nvmlValueType_t* sampleValType, unsigned int* sampleCount, nvmlSample_t* samples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetBAR1MemoryInfo(nvmlDevice_t device, nvmlBAR1Memory_t* bar1Memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetIrqNum(nvmlDevice_t device, unsigned int* irqNum) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNumGpuCores(nvmlDevice_t device, unsigned int* numCores) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPowerSource(nvmlDevice_t device, nvmlPowerSource_t* powerSource) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMemoryBusWidth(nvmlDevice_t device, unsigned int* busWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPcieLinkMaxSpeed(nvmlDevice_t device, unsigned int* maxSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPcieSpeed(nvmlDevice_t device, unsigned int* pcieSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetAdaptiveClockInfoStatus(nvmlDevice_t device, unsigned int* adaptiveClockStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetBusType(nvmlDevice_t device, nvmlBusType_t* type) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpuFabricInfoV(nvmlDevice_t device, nvmlGpuFabricInfoV_t* gpuFabricInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetConfComputeCapabilities(nvmlConfComputeSystemCaps_t* capabilities) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetConfComputeState(nvmlConfComputeSystemState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetConfComputeMemSizeInfo(nvmlDevice_t device, nvmlConfComputeMemSizeInfo_t* memInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetConfComputeGpusReadyState(unsigned int* isAcceptingWork) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetConfComputeProtectedMemoryUsage(nvmlDevice_t device, nvmlMemory_t* memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetConfComputeGpuCertificate(nvmlDevice_t device, nvmlConfComputeGpuCertificate_t* gpuCert) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetConfComputeGpuAttestationReport(nvmlDevice_t device, nvmlConfComputeGpuAttestationReport_t* gpuAtstReport) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetConfComputeKeyRotationThresholdInfo(nvmlConfComputeGetKeyRotationThresholdInfo_t* pKeyRotationThrInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetConfComputeUnprotectedMemSize(nvmlDevice_t device, unsigned long long sizeKiB) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemSetConfComputeGpusReadyState(unsigned int isAcceptingWork) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemSetConfComputeKeyRotationThresholdInfo(nvmlConfComputeSetKeyRotationThresholdInfo_t* pKeyRotationThrInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetConfComputeSettings(nvmlSystemConfComputeSettings_t* settings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGspFirmwareVersion(nvmlDevice_t device, char* version) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGspFirmwareMode(nvmlDevice_t device, unsigned int* isEnabled, unsigned int* defaultMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetSramEccErrorStatus(nvmlDevice_t device, nvmlEccSramErrorStatus_t* status) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetAccountingMode(nvmlDevice_t device, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetAccountingStats(nvmlDevice_t device, unsigned int pid, nvmlAccountingStats_t* stats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetAccountingPids(nvmlDevice_t device, unsigned int* count, unsigned int* pids) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetAccountingBufferSize(nvmlDevice_t device, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetRetiredPages(nvmlDevice_t device, nvmlPageRetirementCause_t cause, unsigned int* pageCount, unsigned long long* addresses) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetRetiredPages_v2(nvmlDevice_t device, nvmlPageRetirementCause_t cause, unsigned int* pageCount, unsigned long long* addresses, unsigned long long* timestamps) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetRetiredPagesPendingStatus(nvmlDevice_t device, nvmlEnableState_t* isPending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetRemappedRows(nvmlDevice_t device, unsigned int* corrRows, unsigned int* uncRows, unsigned int* isPending, unsigned int* failureOccurred) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetRowRemapperHistogram(nvmlDevice_t device, nvmlRowRemapperHistogramValues_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetArchitecture(nvmlDevice_t device, nvmlDeviceArchitecture_t* arch) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetClkMonStatus(nvmlDevice_t device, nvmlClkMonStatus_t* status) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetProcessUtilization(nvmlDevice_t device, nvmlProcessUtilizationSample_t* utilization, unsigned int* processSamplesCount, unsigned long long lastSeenTimeStamp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetProcessesUtilizationInfo(nvmlDevice_t device, nvmlProcessesUtilizationInfo_t* procesesUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPlatformInfo(nvmlDevice_t device, nvmlPlatformInfo_t* platformInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlUnitSetLedState(nvmlUnit_t unit, nvmlLedColor_t color) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetComputeMode(nvmlDevice_t device, nvmlComputeMode_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetEccMode(nvmlDevice_t device, nvmlEnableState_t ecc) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceClearEccErrorCounts(nvmlDevice_t device, nvmlEccCounterType_t counterType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetDriverModel(nvmlDevice_t device, nvmlDriverModel_t driverModel, unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetGpuLockedClocks(nvmlDevice_t device, unsigned int minGpuClockMHz, unsigned int maxGpuClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceResetGpuLockedClocks(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetMemoryLockedClocks(nvmlDevice_t device, unsigned int minMemClockMHz, unsigned int maxMemClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceResetMemoryLockedClocks(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetDefaultAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled, unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetDefaultFanSpeed_v2(nvmlDevice_t device, unsigned int fan) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetFanControlPolicy(nvmlDevice_t device, unsigned int fan, nvmlFanControlPolicy_t policy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetTemperatureThreshold(nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetPowerManagementLimit(nvmlDevice_t device, unsigned int limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t isRestricted) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetFanSpeed_v2(nvmlDevice_t device, unsigned int fan, unsigned int speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetAccountingMode(nvmlDevice_t device, nvmlEnableState_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceClearAccountingPids(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetPowerManagementLimit_v2(nvmlDevice_t device, nvmlPowerValue_v2_t* powerValue) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNvLinkState(nvmlDevice_t device, unsigned int link, nvmlEnableState_t* isActive) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNvLinkVersion(nvmlDevice_t device, unsigned int link, unsigned int* version) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNvLinkCapability(nvmlDevice_t device, unsigned int link, nvmlNvLinkCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNvLinkRemotePciInfo_v2(nvmlDevice_t device, unsigned int link, nvmlPciInfo_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNvLinkErrorCounter(nvmlDevice_t device, unsigned int link, nvmlNvLinkErrorCounter_t counter, unsigned long long* counterValue) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceResetNvLinkErrorCounters(nvmlDevice_t device, unsigned int link) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNvLinkRemoteDeviceType(nvmlDevice_t device, unsigned int link, nvmlIntNvLinkDeviceType_t* pNvLinkDeviceType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetNvLinkDeviceLowPowerThreshold(nvmlDevice_t device, nvmlNvLinkPowerThres_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemSetNvlinkBwMode(unsigned int nvlinkBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetNvlinkBwMode(unsigned int* nvlinkBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNvlinkSupportedBwModes(nvmlDevice_t device, nvmlNvlinkSupportedBwModes_t* supportedBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNvlinkBwMode(nvmlDevice_t device, nvmlNvlinkGetBwMode_t* getBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetNvlinkBwMode(nvmlDevice_t device, nvmlNvlinkSetBwMode_t* setBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlEventSetCreate(nvmlEventSet_t* set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceRegisterEvents(nvmlDevice_t device, unsigned long long eventTypes, nvmlEventSet_t set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetSupportedEventTypes(nvmlDevice_t device, unsigned long long* eventTypes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlEventSetWait_v2(nvmlEventSet_t set, nvmlEventData_t* data, unsigned int timeoutms) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlEventSetFree(nvmlEventSet_t set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemEventSetCreate(nvmlSystemEventSetCreateRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemEventSetFree(nvmlSystemEventSetFreeRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemRegisterEvents(nvmlSystemRegisterEventRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemEventSetWait(nvmlSystemEventSetWaitRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceModifyDrainState(nvmlPciInfo_t* pciInfo, nvmlEnableState_t newState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceQueryDrainState(nvmlPciInfo_t* pciInfo, nvmlEnableState_t* currentState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceRemoveGpu_v2(nvmlPciInfo_t* pciInfo, nvmlDetachGpuState_t gpuState, nvmlPcieLinkState_t linkState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceDiscoverGpus(nvmlPciInfo_t* pciInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetFieldValues(nvmlDevice_t device, int valuesCount, nvmlFieldValue_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceClearFieldValues(nvmlDevice_t device, int valuesCount, nvmlFieldValue_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t* pVirtualMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetHostVgpuMode(nvmlDevice_t device, nvmlHostVgpuMode_t* pHostVgpuMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t virtualMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuHeterogeneousMode(nvmlDevice_t device, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetVgpuHeterogeneousMode(nvmlDevice_t device, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetPlacementId(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuPlacementId_t* pPlacement) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuTypeSupportedPlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuTypeCreatablePlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetGspHeapSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* gspHeapSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetFbReservation(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbReservation) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetRuntimeStateSize(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuRuntimeState_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetVgpuCapabilities(nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, nvmlEnableState_t state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGridLicensableFeatures_v4(nvmlDevice_t device, nvmlGridLicensableFeatures_t* pGridLicensableFeatures) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGetVgpuDriverCapabilities(nvmlVgpuDriverCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuCapabilities(nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetSupportedVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuTypeId_t* vgpuTypeIds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCreatableVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuTypeId_t* vgpuTypeIds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetClass(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeClass, unsigned int* size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetName(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeName, unsigned int* size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetGpuInstanceProfileId(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* gpuInstanceProfileId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetDeviceID(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* deviceID, unsigned long long* subsystemID) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetFramebufferSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetNumDisplayHeads(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* numDisplayHeads) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetResolution(nvmlVgpuTypeId_t vgpuTypeId, unsigned int displayIndex, unsigned int* xdim, unsigned int* ydim) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetLicense(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeLicenseString, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetFrameRateLimit(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* frameRateLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetMaxInstances(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, unsigned int* vgpuInstanceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetMaxInstancesPerVm(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* vgpuInstanceCountPerVm) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetBAR1Info(nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuTypeBar1Info_t* bar1Info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetActiveVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuInstance_t* vgpuInstances) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetVmID(nvmlVgpuInstance_t vgpuInstance, char* vmId, unsigned int size, nvmlVgpuVmIdType_t* vmIdType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetUUID(nvmlVgpuInstance_t vgpuInstance, char* uuid, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetVmDriverVersion(nvmlVgpuInstance_t vgpuInstance, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetFbUsage(nvmlVgpuInstance_t vgpuInstance, unsigned long long* fbUsage) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetLicenseStatus(nvmlVgpuInstance_t vgpuInstance, unsigned int* licensed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetType(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuTypeId_t* vgpuTypeId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetFrameRateLimit(nvmlVgpuInstance_t vgpuInstance, unsigned int* frameRateLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetEccMode(nvmlVgpuInstance_t vgpuInstance, nvmlEnableState_t* eccMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int* encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceSetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetEncoderStats(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, unsigned int* averageFps, unsigned int* averageLatency) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetEncoderSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, nvmlEncoderSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetFBCStats(nvmlVgpuInstance_t vgpuInstance, nvmlFBCStats_t* fbcStats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetFBCSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, nvmlFBCSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetGpuInstanceId(nvmlVgpuInstance_t vgpuInstance, unsigned int* gpuInstanceId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetGpuPciId(nvmlVgpuInstance_t vgpuInstance, char* vgpuPciId, unsigned int* length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetCapabilities(nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetMdevUUID(nvmlVgpuInstance_t vgpuInstance, char* mdevUuid, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetCreatableVgpus(nvmlGpuInstance_t gpuInstance, nvmlVgpuTypeIdInfo_t* pVgpus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetMaxInstancesPerGpuInstance(nvmlVgpuTypeMaxInstance_t* pMaxInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetActiveVgpus(nvmlGpuInstance_t gpuInstance, nvmlActiveVgpuInstanceInfo_t* pVgpuInstanceInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceSetVgpuSchedulerState(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerState_t* pScheduler) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetVgpuSchedulerState(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerStateInfo_t* pSchedulerStateInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetVgpuSchedulerLog(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerLogInfo_t* pSchedulerLogInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetVgpuTypeCreatablePlacements(nvmlGpuInstance_t gpuInstance, nvmlVgpuCreatablePlacementInfo_t* pCreatablePlacementInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetVgpuHeterogeneousMode(nvmlGpuInstance_t gpuInstance, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceSetVgpuHeterogeneousMode(nvmlGpuInstance_t gpuInstance, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetMetadata(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuMetadata_t* vgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuMetadata(nvmlDevice_t device, nvmlVgpuPgpuMetadata_t* pgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGetVgpuCompatibility(nvmlVgpuMetadata_t* vgpuMetadata, nvmlVgpuPgpuMetadata_t* pgpuMetadata, nvmlVgpuPgpuCompatibility_t* compatibilityInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPgpuMetadataString(nvmlDevice_t device, char* pgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuSchedulerLog(nvmlDevice_t device, nvmlVgpuSchedulerLog_t* pSchedulerLog) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuSchedulerState(nvmlDevice_t device, nvmlVgpuSchedulerGetState_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuSchedulerCapabilities(nvmlDevice_t device, nvmlVgpuSchedulerCapabilities_t* pCapabilities) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetVgpuSchedulerState(nvmlDevice_t device, nvmlVgpuSchedulerSetState_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGetVgpuVersion(nvmlVgpuVersion_t* supported, nvmlVgpuVersion_t* current) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSetVgpuVersion(nvmlVgpuVersion_t* vgpuVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, nvmlValueType_t* sampleValType, unsigned int* vgpuInstanceSamplesCount, nvmlVgpuInstanceUtilizationSample_t* utilizationSamples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuInstancesUtilizationInfo(nvmlDevice_t device, nvmlVgpuInstancesUtilizationInfo_t* vgpuUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuProcessUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, unsigned int* vgpuProcessSamplesCount, nvmlVgpuProcessUtilizationSample_t* utilizationSamples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuProcessesUtilizationInfo(nvmlDevice_t device, nvmlVgpuProcessesUtilizationInfo_t* vgpuProcUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetAccountingMode(nvmlVgpuInstance_t vgpuInstance, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetAccountingPids(nvmlVgpuInstance_t vgpuInstance, unsigned int* count, unsigned int* pids) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetAccountingStats(nvmlVgpuInstance_t vgpuInstance, unsigned int pid, nvmlAccountingStats_t* stats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceClearAccountingPids(nvmlVgpuInstance_t vgpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetLicenseInfo_v2(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuLicenseInfo_t* licenseInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGetExcludedDeviceCount(unsigned int* deviceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGetExcludedDeviceInfoByIndex(unsigned int index, nvmlExcludedDeviceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetMigMode(nvmlDevice_t device, unsigned int mode, nvmlReturn_t* activationStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMigMode(nvmlDevice_t device, unsigned int* currentMode, unsigned int* pendingMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpuInstanceProfileInfoV(nvmlDevice_t device, unsigned int profile, nvmlGpuInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpuInstancePossiblePlacements_v2(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstancePlacement_t* placements, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpuInstanceRemainingCapacity(nvmlDevice_t device, unsigned int profileId, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceCreateGpuInstance(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceCreateGpuInstanceWithPlacement(nvmlDevice_t device, unsigned int profileId, const nvmlGpuInstancePlacement_t* placement, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceDestroy(nvmlGpuInstance_t gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpuInstances(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t* gpuInstances, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpuInstanceById(nvmlDevice_t device, unsigned int id, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetInfo(nvmlGpuInstance_t gpuInstance, nvmlGpuInstanceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetComputeInstanceProfileInfoV(nvmlGpuInstance_t gpuInstance, unsigned int profile, unsigned int engProfile, nvmlComputeInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetComputeInstanceRemainingCapacity(nvmlGpuInstance_t gpuInstance, unsigned int profileId, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetComputeInstancePossiblePlacements(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstancePlacement_t* placements, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceCreateComputeInstance(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceCreateComputeInstanceWithPlacement(nvmlGpuInstance_t gpuInstance, unsigned int profileId, const nvmlComputeInstancePlacement_t* placement, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlComputeInstanceDestroy(nvmlComputeInstance_t computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetComputeInstances(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t* computeInstances, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetComputeInstanceById(nvmlGpuInstance_t gpuInstance, unsigned int id, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlComputeInstanceGetInfo_v2(nvmlComputeInstance_t computeInstance, nvmlComputeInstanceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceIsMigDeviceHandle(nvmlDevice_t device, unsigned int* isMigDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpuInstanceId(nvmlDevice_t device, unsigned int* id) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetComputeInstanceId(nvmlDevice_t device, unsigned int* id) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMaxMigDeviceCount(nvmlDevice_t device, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMigDeviceHandleByIndex(nvmlDevice_t device, unsigned int index, nvmlDevice_t* migDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetDeviceHandleFromMigDeviceHandle(nvmlDevice_t migDevice, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpmSampleGet(nvmlDevice_t device, nvmlGpmSample_t gpmSample) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpmMigSampleGet(nvmlDevice_t device, unsigned int gpuInstanceId, nvmlGpmSample_t gpmSample) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpmQueryDeviceSupport(nvmlDevice_t device, nvmlGpmSupport_t* gpmSupport) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpmQueryIfStreamingEnabled(nvmlDevice_t device, unsigned int* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpmSetStreamingEnabled(nvmlDevice_t device, unsigned int state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCapabilities(nvmlDevice_t device, nvmlDeviceCapabilities_t* caps) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceWorkloadPowerProfileClearRequestedProfiles(nvmlDevice_t device, nvmlWorkloadPowerProfileRequestedProfiles_t* requestedProfiles) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDevicePowerSmoothingActivatePresetProfile(nvmlDevice_t device, nvmlPowerSmoothingProfile_t* profile) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDevicePowerSmoothingUpdatePresetProfileParam(nvmlDevice_t device, nvmlPowerSmoothingProfile_t* profile) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDevicePowerSmoothingSetState(nvmlDevice_t device, nvmlPowerSmoothingState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetAddressingMode(nvmlDevice_t device, nvmlDeviceAddressingMode_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetRepairStatus(nvmlDevice_t device, nvmlRepairStatus_t* repairStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t* powerMizerMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t* powerMizerMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPdi(nvmlDevice_t device, nvmlPdi_t* pdi) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetHostname_v1(nvmlDevice_t device, nvmlHostname_v1_t* hostname) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetHostname_v1(nvmlDevice_t device, nvmlHostname_v1_t* hostname) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNvLinkInfo(nvmlDevice_t device, nvmlNvLinkInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceReadWritePRM_v1(nvmlDevice_t device, nvmlPRMTLV_v1_t* buffer) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpuInstanceProfileInfoByIdV(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(nvmlDevice_t device, nvmlEccSramUniqueUncorrectedErrorCounts_t* errorCounts) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil diff --git a/cuda_bindings/cuda/bindings/cynvml.pyx b/cuda_bindings/cuda/bindings/cynvml.pyx new file mode 100644 index 0000000000..b0fbcd08a9 --- /dev/null +++ b/cuda_bindings/cuda/bindings/cynvml.pyx @@ -0,0 +1,1403 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE +# +# This code was automatically generated across versions from 12.9.1 to 13.0.1. Do not modify it directly. + +from ._internal cimport nvml as _nvml + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef nvmlReturn_t nvmlInit_v2() except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlInit_v2() + + +cdef nvmlReturn_t nvmlInitWithFlags(unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlInitWithFlags(flags) + + +cdef nvmlReturn_t nvmlShutdown() except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlShutdown() + + +cdef const char* nvmlErrorString(nvmlReturn_t result) except?NULL nogil: + return _nvml._nvmlErrorString(result) + + +cdef nvmlReturn_t nvmlSystemGetDriverVersion(char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetDriverVersion(version, length) + + +cdef nvmlReturn_t nvmlSystemGetNVMLVersion(char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetNVMLVersion(version, length) + + +cdef nvmlReturn_t nvmlSystemGetCudaDriverVersion(int* cudaDriverVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetCudaDriverVersion(cudaDriverVersion) + + +cdef nvmlReturn_t nvmlSystemGetCudaDriverVersion_v2(int* cudaDriverVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetCudaDriverVersion_v2(cudaDriverVersion) + + +cdef nvmlReturn_t nvmlSystemGetProcessName(unsigned int pid, char* name, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetProcessName(pid, name, length) + + +cdef nvmlReturn_t nvmlSystemGetHicVersion(unsigned int* hwbcCount, nvmlHwbcEntry_t* hwbcEntries) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetHicVersion(hwbcCount, hwbcEntries) + + +cdef nvmlReturn_t nvmlSystemGetTopologyGpuSet(unsigned int cpuNumber, unsigned int* count, nvmlDevice_t* deviceArray) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetTopologyGpuSet(cpuNumber, count, deviceArray) + + +cdef nvmlReturn_t nvmlSystemGetDriverBranch(nvmlSystemDriverBranchInfo_t* branchInfo, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetDriverBranch(branchInfo, length) + + +cdef nvmlReturn_t nvmlUnitGetCount(unsigned int* unitCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlUnitGetCount(unitCount) + + +cdef nvmlReturn_t nvmlUnitGetHandleByIndex(unsigned int index, nvmlUnit_t* unit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlUnitGetHandleByIndex(index, unit) + + +cdef nvmlReturn_t nvmlUnitGetUnitInfo(nvmlUnit_t unit, nvmlUnitInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlUnitGetUnitInfo(unit, info) + + +cdef nvmlReturn_t nvmlUnitGetLedState(nvmlUnit_t unit, nvmlLedState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlUnitGetLedState(unit, state) + + +cdef nvmlReturn_t nvmlUnitGetPsuInfo(nvmlUnit_t unit, nvmlPSUInfo_t* psu) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlUnitGetPsuInfo(unit, psu) + + +cdef nvmlReturn_t nvmlUnitGetTemperature(nvmlUnit_t unit, unsigned int type, unsigned int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlUnitGetTemperature(unit, type, temp) + + +cdef nvmlReturn_t nvmlUnitGetFanSpeedInfo(nvmlUnit_t unit, nvmlUnitFanSpeeds_t* fanSpeeds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlUnitGetFanSpeedInfo(unit, fanSpeeds) + + +cdef nvmlReturn_t nvmlUnitGetDevices(nvmlUnit_t unit, unsigned int* deviceCount, nvmlDevice_t* devices) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlUnitGetDevices(unit, deviceCount, devices) + + +cdef nvmlReturn_t nvmlDeviceGetCount_v2(unsigned int* deviceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCount_v2(deviceCount) + + +cdef nvmlReturn_t nvmlDeviceGetAttributes_v2(nvmlDevice_t device, nvmlDeviceAttributes_t* attributes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetAttributes_v2(device, attributes) + + +cdef nvmlReturn_t nvmlDeviceGetHandleByIndex_v2(unsigned int index, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetHandleByIndex_v2(index, device) + + +cdef nvmlReturn_t nvmlDeviceGetHandleBySerial(const char* serial, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetHandleBySerial(serial, device) + + +cdef nvmlReturn_t nvmlDeviceGetHandleByUUID(const char* uuid, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetHandleByUUID(uuid, device) + + +cdef nvmlReturn_t nvmlDeviceGetHandleByUUIDV(const nvmlUUID_t* uuid, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetHandleByUUIDV(uuid, device) + + +cdef nvmlReturn_t nvmlDeviceGetHandleByPciBusId_v2(const char* pciBusId, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetHandleByPciBusId_v2(pciBusId, device) + + +cdef nvmlReturn_t nvmlDeviceGetName(nvmlDevice_t device, char* name, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetName(device, name, length) + + +cdef nvmlReturn_t nvmlDeviceGetBrand(nvmlDevice_t device, nvmlBrandType_t* type) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetBrand(device, type) + + +cdef nvmlReturn_t nvmlDeviceGetIndex(nvmlDevice_t device, unsigned int* index) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetIndex(device, index) + + +cdef nvmlReturn_t nvmlDeviceGetSerial(nvmlDevice_t device, char* serial, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetSerial(device, serial, length) + + +cdef nvmlReturn_t nvmlDeviceGetModuleId(nvmlDevice_t device, unsigned int* moduleId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetModuleId(device, moduleId) + + +cdef nvmlReturn_t nvmlDeviceGetC2cModeInfoV(nvmlDevice_t device, nvmlC2cModeInfo_v1_t* c2cModeInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetC2cModeInfoV(device, c2cModeInfo) + + +cdef nvmlReturn_t nvmlDeviceGetMemoryAffinity(nvmlDevice_t device, unsigned int nodeSetSize, unsigned long* nodeSet, nvmlAffinityScope_t scope) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMemoryAffinity(device, nodeSetSize, nodeSet, scope) + + +cdef nvmlReturn_t nvmlDeviceGetCpuAffinityWithinScope(nvmlDevice_t device, unsigned int cpuSetSize, unsigned long* cpuSet, nvmlAffinityScope_t scope) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCpuAffinityWithinScope(device, cpuSetSize, cpuSet, scope) + + +cdef nvmlReturn_t nvmlDeviceGetCpuAffinity(nvmlDevice_t device, unsigned int cpuSetSize, unsigned long* cpuSet) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCpuAffinity(device, cpuSetSize, cpuSet) + + +cdef nvmlReturn_t nvmlDeviceSetCpuAffinity(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetCpuAffinity(device) + + +cdef nvmlReturn_t nvmlDeviceClearCpuAffinity(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceClearCpuAffinity(device) + + +cdef nvmlReturn_t nvmlDeviceGetNumaNodeId(nvmlDevice_t device, unsigned int* node) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNumaNodeId(device, node) + + +cdef nvmlReturn_t nvmlDeviceGetTopologyCommonAncestor(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuTopologyLevel_t* pathInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetTopologyCommonAncestor(device1, device2, pathInfo) + + +cdef nvmlReturn_t nvmlDeviceGetTopologyNearestGpus(nvmlDevice_t device, nvmlGpuTopologyLevel_t level, unsigned int* count, nvmlDevice_t* deviceArray) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetTopologyNearestGpus(device, level, count, deviceArray) + + +cdef nvmlReturn_t nvmlDeviceGetP2PStatus(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuP2PCapsIndex_t p2pIndex, nvmlGpuP2PStatus_t* p2pStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetP2PStatus(device1, device2, p2pIndex, p2pStatus) + + +cdef nvmlReturn_t nvmlDeviceGetUUID(nvmlDevice_t device, char* uuid, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetUUID(device, uuid, length) + + +cdef nvmlReturn_t nvmlDeviceGetMinorNumber(nvmlDevice_t device, unsigned int* minorNumber) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMinorNumber(device, minorNumber) + + +cdef nvmlReturn_t nvmlDeviceGetBoardPartNumber(nvmlDevice_t device, char* partNumber, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetBoardPartNumber(device, partNumber, length) + + +cdef nvmlReturn_t nvmlDeviceGetInforomVersion(nvmlDevice_t device, nvmlInforomObject_t object, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetInforomVersion(device, object, version, length) + + +cdef nvmlReturn_t nvmlDeviceGetInforomImageVersion(nvmlDevice_t device, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetInforomImageVersion(device, version, length) + + +cdef nvmlReturn_t nvmlDeviceGetInforomConfigurationChecksum(nvmlDevice_t device, unsigned int* checksum) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetInforomConfigurationChecksum(device, checksum) + + +cdef nvmlReturn_t nvmlDeviceValidateInforom(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceValidateInforom(device) + + +cdef nvmlReturn_t nvmlDeviceGetLastBBXFlushTime(nvmlDevice_t device, unsigned long long* timestamp, unsigned long* durationUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetLastBBXFlushTime(device, timestamp, durationUs) + + +cdef nvmlReturn_t nvmlDeviceGetDisplayMode(nvmlDevice_t device, nvmlEnableState_t* display) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetDisplayMode(device, display) + + +cdef nvmlReturn_t nvmlDeviceGetDisplayActive(nvmlDevice_t device, nvmlEnableState_t* isActive) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetDisplayActive(device, isActive) + + +cdef nvmlReturn_t nvmlDeviceGetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPersistenceMode(device, mode) + + +cdef nvmlReturn_t nvmlDeviceGetPciInfoExt(nvmlDevice_t device, nvmlPciInfoExt_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPciInfoExt(device, pci) + + +cdef nvmlReturn_t nvmlDeviceGetPciInfo_v3(nvmlDevice_t device, nvmlPciInfo_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPciInfo_v3(device, pci) + + +cdef nvmlReturn_t nvmlDeviceGetMaxPcieLinkGeneration(nvmlDevice_t device, unsigned int* maxLinkGen) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMaxPcieLinkGeneration(device, maxLinkGen) + + +cdef nvmlReturn_t nvmlDeviceGetGpuMaxPcieLinkGeneration(nvmlDevice_t device, unsigned int* maxLinkGenDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpuMaxPcieLinkGeneration(device, maxLinkGenDevice) + + +cdef nvmlReturn_t nvmlDeviceGetMaxPcieLinkWidth(nvmlDevice_t device, unsigned int* maxLinkWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMaxPcieLinkWidth(device, maxLinkWidth) + + +cdef nvmlReturn_t nvmlDeviceGetCurrPcieLinkGeneration(nvmlDevice_t device, unsigned int* currLinkGen) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCurrPcieLinkGeneration(device, currLinkGen) + + +cdef nvmlReturn_t nvmlDeviceGetCurrPcieLinkWidth(nvmlDevice_t device, unsigned int* currLinkWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCurrPcieLinkWidth(device, currLinkWidth) + + +cdef nvmlReturn_t nvmlDeviceGetPcieThroughput(nvmlDevice_t device, nvmlPcieUtilCounter_t counter, unsigned int* value) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPcieThroughput(device, counter, value) + + +cdef nvmlReturn_t nvmlDeviceGetPcieReplayCounter(nvmlDevice_t device, unsigned int* value) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPcieReplayCounter(device, value) + + +cdef nvmlReturn_t nvmlDeviceGetClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetClockInfo(device, type, clock) + + +cdef nvmlReturn_t nvmlDeviceGetMaxClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMaxClockInfo(device, type, clock) + + +cdef nvmlReturn_t nvmlDeviceGetGpcClkVfOffset(nvmlDevice_t device, int* offset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpcClkVfOffset(device, offset) + + +cdef nvmlReturn_t nvmlDeviceGetClock(nvmlDevice_t device, nvmlClockType_t clockType, nvmlClockId_t clockId, unsigned int* clockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetClock(device, clockType, clockId, clockMHz) + + +cdef nvmlReturn_t nvmlDeviceGetMaxCustomerBoostClock(nvmlDevice_t device, nvmlClockType_t clockType, unsigned int* clockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMaxCustomerBoostClock(device, clockType, clockMHz) + + +cdef nvmlReturn_t nvmlDeviceGetSupportedMemoryClocks(nvmlDevice_t device, unsigned int* count, unsigned int* clocksMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetSupportedMemoryClocks(device, count, clocksMHz) + + +cdef nvmlReturn_t nvmlDeviceGetSupportedGraphicsClocks(nvmlDevice_t device, unsigned int memoryClockMHz, unsigned int* count, unsigned int* clocksMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetSupportedGraphicsClocks(device, memoryClockMHz, count, clocksMHz) + + +cdef nvmlReturn_t nvmlDeviceGetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t* isEnabled, nvmlEnableState_t* defaultIsEnabled) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetAutoBoostedClocksEnabled(device, isEnabled, defaultIsEnabled) + + +cdef nvmlReturn_t nvmlDeviceGetFanSpeed(nvmlDevice_t device, unsigned int* speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetFanSpeed(device, speed) + + +cdef nvmlReturn_t nvmlDeviceGetFanSpeed_v2(nvmlDevice_t device, unsigned int fan, unsigned int* speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetFanSpeed_v2(device, fan, speed) + + +cdef nvmlReturn_t nvmlDeviceGetFanSpeedRPM(nvmlDevice_t device, nvmlFanSpeedInfo_t* fanSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetFanSpeedRPM(device, fanSpeed) + + +cdef nvmlReturn_t nvmlDeviceGetTargetFanSpeed(nvmlDevice_t device, unsigned int fan, unsigned int* targetSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetTargetFanSpeed(device, fan, targetSpeed) + + +cdef nvmlReturn_t nvmlDeviceGetMinMaxFanSpeed(nvmlDevice_t device, unsigned int* minSpeed, unsigned int* maxSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMinMaxFanSpeed(device, minSpeed, maxSpeed) + + +cdef nvmlReturn_t nvmlDeviceGetFanControlPolicy_v2(nvmlDevice_t device, unsigned int fan, nvmlFanControlPolicy_t* policy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetFanControlPolicy_v2(device, fan, policy) + + +cdef nvmlReturn_t nvmlDeviceGetNumFans(nvmlDevice_t device, unsigned int* numFans) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNumFans(device, numFans) + + +cdef nvmlReturn_t nvmlDeviceGetCoolerInfo(nvmlDevice_t device, nvmlCoolerInfo_t* coolerInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCoolerInfo(device, coolerInfo) + + +cdef nvmlReturn_t nvmlDeviceGetTemperatureV(nvmlDevice_t device, nvmlTemperature_t* temperature) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetTemperatureV(device, temperature) + + +cdef nvmlReturn_t nvmlDeviceGetTemperatureThreshold(nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, unsigned int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetTemperatureThreshold(device, thresholdType, temp) + + +cdef nvmlReturn_t nvmlDeviceGetMarginTemperature(nvmlDevice_t device, nvmlMarginTemperature_t* marginTempInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMarginTemperature(device, marginTempInfo) + + +cdef nvmlReturn_t nvmlDeviceGetThermalSettings(nvmlDevice_t device, unsigned int sensorIndex, nvmlGpuThermalSettings_t* pThermalSettings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetThermalSettings(device, sensorIndex, pThermalSettings) + + +cdef nvmlReturn_t nvmlDeviceGetPerformanceState(nvmlDevice_t device, nvmlPstates_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPerformanceState(device, pState) + + +cdef nvmlReturn_t nvmlDeviceGetCurrentClocksEventReasons(nvmlDevice_t device, unsigned long long* clocksEventReasons) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCurrentClocksEventReasons(device, clocksEventReasons) + + +cdef nvmlReturn_t nvmlDeviceGetSupportedClocksEventReasons(nvmlDevice_t device, unsigned long long* supportedClocksEventReasons) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetSupportedClocksEventReasons(device, supportedClocksEventReasons) + + +cdef nvmlReturn_t nvmlDeviceGetPowerState(nvmlDevice_t device, nvmlPstates_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPowerState(device, pState) + + +cdef nvmlReturn_t nvmlDeviceGetDynamicPstatesInfo(nvmlDevice_t device, nvmlGpuDynamicPstatesInfo_t* pDynamicPstatesInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetDynamicPstatesInfo(device, pDynamicPstatesInfo) + + +cdef nvmlReturn_t nvmlDeviceGetMemClkVfOffset(nvmlDevice_t device, int* offset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMemClkVfOffset(device, offset) + + +cdef nvmlReturn_t nvmlDeviceGetMinMaxClockOfPState(nvmlDevice_t device, nvmlClockType_t type, nvmlPstates_t pstate, unsigned int* minClockMHz, unsigned int* maxClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMinMaxClockOfPState(device, type, pstate, minClockMHz, maxClockMHz) + + +cdef nvmlReturn_t nvmlDeviceGetSupportedPerformanceStates(nvmlDevice_t device, nvmlPstates_t* pstates, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetSupportedPerformanceStates(device, pstates, size) + + +cdef nvmlReturn_t nvmlDeviceGetGpcClkMinMaxVfOffset(nvmlDevice_t device, int* minOffset, int* maxOffset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpcClkMinMaxVfOffset(device, minOffset, maxOffset) + + +cdef nvmlReturn_t nvmlDeviceGetMemClkMinMaxVfOffset(nvmlDevice_t device, int* minOffset, int* maxOffset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMemClkMinMaxVfOffset(device, minOffset, maxOffset) + + +cdef nvmlReturn_t nvmlDeviceGetClockOffsets(nvmlDevice_t device, nvmlClockOffset_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetClockOffsets(device, info) + + +cdef nvmlReturn_t nvmlDeviceSetClockOffsets(nvmlDevice_t device, nvmlClockOffset_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetClockOffsets(device, info) + + +cdef nvmlReturn_t nvmlDeviceGetPerformanceModes(nvmlDevice_t device, nvmlDevicePerfModes_t* perfModes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPerformanceModes(device, perfModes) + + +cdef nvmlReturn_t nvmlDeviceGetCurrentClockFreqs(nvmlDevice_t device, nvmlDeviceCurrentClockFreqs_t* currentClockFreqs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCurrentClockFreqs(device, currentClockFreqs) + + +cdef nvmlReturn_t nvmlDeviceGetPowerManagementLimit(nvmlDevice_t device, unsigned int* limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPowerManagementLimit(device, limit) + + +cdef nvmlReturn_t nvmlDeviceGetPowerManagementLimitConstraints(nvmlDevice_t device, unsigned int* minLimit, unsigned int* maxLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPowerManagementLimitConstraints(device, minLimit, maxLimit) + + +cdef nvmlReturn_t nvmlDeviceGetPowerManagementDefaultLimit(nvmlDevice_t device, unsigned int* defaultLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPowerManagementDefaultLimit(device, defaultLimit) + + +cdef nvmlReturn_t nvmlDeviceGetPowerUsage(nvmlDevice_t device, unsigned int* power) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPowerUsage(device, power) + + +cdef nvmlReturn_t nvmlDeviceGetTotalEnergyConsumption(nvmlDevice_t device, unsigned long long* energy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetTotalEnergyConsumption(device, energy) + + +cdef nvmlReturn_t nvmlDeviceGetEnforcedPowerLimit(nvmlDevice_t device, unsigned int* limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetEnforcedPowerLimit(device, limit) + + +cdef nvmlReturn_t nvmlDeviceGetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t* current, nvmlGpuOperationMode_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpuOperationMode(device, current, pending) + + +cdef nvmlReturn_t nvmlDeviceGetMemoryInfo_v2(nvmlDevice_t device, nvmlMemory_v2_t* memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMemoryInfo_v2(device, memory) + + +cdef nvmlReturn_t nvmlDeviceGetComputeMode(nvmlDevice_t device, nvmlComputeMode_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetComputeMode(device, mode) + + +cdef nvmlReturn_t nvmlDeviceGetCudaComputeCapability(nvmlDevice_t device, int* major, int* minor) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCudaComputeCapability(device, major, minor) + + +cdef nvmlReturn_t nvmlDeviceGetDramEncryptionMode(nvmlDevice_t device, nvmlDramEncryptionInfo_t* current, nvmlDramEncryptionInfo_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetDramEncryptionMode(device, current, pending) + + +cdef nvmlReturn_t nvmlDeviceSetDramEncryptionMode(nvmlDevice_t device, const nvmlDramEncryptionInfo_t* dramEncryption) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetDramEncryptionMode(device, dramEncryption) + + +cdef nvmlReturn_t nvmlDeviceGetEccMode(nvmlDevice_t device, nvmlEnableState_t* current, nvmlEnableState_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetEccMode(device, current, pending) + + +cdef nvmlReturn_t nvmlDeviceGetDefaultEccMode(nvmlDevice_t device, nvmlEnableState_t* defaultMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetDefaultEccMode(device, defaultMode) + + +cdef nvmlReturn_t nvmlDeviceGetBoardId(nvmlDevice_t device, unsigned int* boardId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetBoardId(device, boardId) + + +cdef nvmlReturn_t nvmlDeviceGetMultiGpuBoard(nvmlDevice_t device, unsigned int* multiGpuBool) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMultiGpuBoard(device, multiGpuBool) + + +cdef nvmlReturn_t nvmlDeviceGetTotalEccErrors(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, unsigned long long* eccCounts) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetTotalEccErrors(device, errorType, counterType, eccCounts) + + +cdef nvmlReturn_t nvmlDeviceGetMemoryErrorCounter(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, nvmlMemoryLocation_t locationType, unsigned long long* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMemoryErrorCounter(device, errorType, counterType, locationType, count) + + +cdef nvmlReturn_t nvmlDeviceGetUtilizationRates(nvmlDevice_t device, nvmlUtilization_t* utilization) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetUtilizationRates(device, utilization) + + +cdef nvmlReturn_t nvmlDeviceGetEncoderUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetEncoderUtilization(device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t nvmlDeviceGetEncoderCapacity(nvmlDevice_t device, nvmlEncoderType_t encoderQueryType, unsigned int* encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetEncoderCapacity(device, encoderQueryType, encoderCapacity) + + +cdef nvmlReturn_t nvmlDeviceGetEncoderStats(nvmlDevice_t device, unsigned int* sessionCount, unsigned int* averageFps, unsigned int* averageLatency) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetEncoderStats(device, sessionCount, averageFps, averageLatency) + + +cdef nvmlReturn_t nvmlDeviceGetEncoderSessions(nvmlDevice_t device, unsigned int* sessionCount, nvmlEncoderSessionInfo_t* sessionInfos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetEncoderSessions(device, sessionCount, sessionInfos) + + +cdef nvmlReturn_t nvmlDeviceGetDecoderUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetDecoderUtilization(device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t nvmlDeviceGetJpgUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetJpgUtilization(device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t nvmlDeviceGetOfaUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetOfaUtilization(device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t nvmlDeviceGetFBCStats(nvmlDevice_t device, nvmlFBCStats_t* fbcStats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetFBCStats(device, fbcStats) + + +cdef nvmlReturn_t nvmlDeviceGetFBCSessions(nvmlDevice_t device, unsigned int* sessionCount, nvmlFBCSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetFBCSessions(device, sessionCount, sessionInfo) + + +cdef nvmlReturn_t nvmlDeviceGetDriverModel_v2(nvmlDevice_t device, nvmlDriverModel_t* current, nvmlDriverModel_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetDriverModel_v2(device, current, pending) + + +cdef nvmlReturn_t nvmlDeviceGetVbiosVersion(nvmlDevice_t device, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVbiosVersion(device, version, length) + + +cdef nvmlReturn_t nvmlDeviceGetBridgeChipInfo(nvmlDevice_t device, nvmlBridgeChipHierarchy_t* bridgeHierarchy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetBridgeChipInfo(device, bridgeHierarchy) + + +cdef nvmlReturn_t nvmlDeviceGetComputeRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetComputeRunningProcesses_v3(device, infoCount, infos) + + +cdef nvmlReturn_t nvmlDeviceGetGraphicsRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGraphicsRunningProcesses_v3(device, infoCount, infos) + + +cdef nvmlReturn_t nvmlDeviceGetMPSComputeRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMPSComputeRunningProcesses_v3(device, infoCount, infos) + + +cdef nvmlReturn_t nvmlDeviceGetRunningProcessDetailList(nvmlDevice_t device, nvmlProcessDetailList_t* plist) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetRunningProcessDetailList(device, plist) + + +cdef nvmlReturn_t nvmlDeviceOnSameBoard(nvmlDevice_t device1, nvmlDevice_t device2, int* onSameBoard) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceOnSameBoard(device1, device2, onSameBoard) + + +cdef nvmlReturn_t nvmlDeviceGetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t* isRestricted) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetAPIRestriction(device, apiType, isRestricted) + + +cdef nvmlReturn_t nvmlDeviceGetSamples(nvmlDevice_t device, nvmlSamplingType_t type, unsigned long long lastSeenTimeStamp, nvmlValueType_t* sampleValType, unsigned int* sampleCount, nvmlSample_t* samples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetSamples(device, type, lastSeenTimeStamp, sampleValType, sampleCount, samples) + + +cdef nvmlReturn_t nvmlDeviceGetBAR1MemoryInfo(nvmlDevice_t device, nvmlBAR1Memory_t* bar1Memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetBAR1MemoryInfo(device, bar1Memory) + + +cdef nvmlReturn_t nvmlDeviceGetIrqNum(nvmlDevice_t device, unsigned int* irqNum) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetIrqNum(device, irqNum) + + +cdef nvmlReturn_t nvmlDeviceGetNumGpuCores(nvmlDevice_t device, unsigned int* numCores) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNumGpuCores(device, numCores) + + +cdef nvmlReturn_t nvmlDeviceGetPowerSource(nvmlDevice_t device, nvmlPowerSource_t* powerSource) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPowerSource(device, powerSource) + + +cdef nvmlReturn_t nvmlDeviceGetMemoryBusWidth(nvmlDevice_t device, unsigned int* busWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMemoryBusWidth(device, busWidth) + + +cdef nvmlReturn_t nvmlDeviceGetPcieLinkMaxSpeed(nvmlDevice_t device, unsigned int* maxSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPcieLinkMaxSpeed(device, maxSpeed) + + +cdef nvmlReturn_t nvmlDeviceGetPcieSpeed(nvmlDevice_t device, unsigned int* pcieSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPcieSpeed(device, pcieSpeed) + + +cdef nvmlReturn_t nvmlDeviceGetAdaptiveClockInfoStatus(nvmlDevice_t device, unsigned int* adaptiveClockStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetAdaptiveClockInfoStatus(device, adaptiveClockStatus) + + +cdef nvmlReturn_t nvmlDeviceGetBusType(nvmlDevice_t device, nvmlBusType_t* type) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetBusType(device, type) + + +cdef nvmlReturn_t nvmlDeviceGetGpuFabricInfoV(nvmlDevice_t device, nvmlGpuFabricInfoV_t* gpuFabricInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpuFabricInfoV(device, gpuFabricInfo) + + +cdef nvmlReturn_t nvmlSystemGetConfComputeCapabilities(nvmlConfComputeSystemCaps_t* capabilities) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetConfComputeCapabilities(capabilities) + + +cdef nvmlReturn_t nvmlSystemGetConfComputeState(nvmlConfComputeSystemState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetConfComputeState(state) + + +cdef nvmlReturn_t nvmlDeviceGetConfComputeMemSizeInfo(nvmlDevice_t device, nvmlConfComputeMemSizeInfo_t* memInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetConfComputeMemSizeInfo(device, memInfo) + + +cdef nvmlReturn_t nvmlSystemGetConfComputeGpusReadyState(unsigned int* isAcceptingWork) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetConfComputeGpusReadyState(isAcceptingWork) + + +cdef nvmlReturn_t nvmlDeviceGetConfComputeProtectedMemoryUsage(nvmlDevice_t device, nvmlMemory_t* memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetConfComputeProtectedMemoryUsage(device, memory) + + +cdef nvmlReturn_t nvmlDeviceGetConfComputeGpuCertificate(nvmlDevice_t device, nvmlConfComputeGpuCertificate_t* gpuCert) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetConfComputeGpuCertificate(device, gpuCert) + + +cdef nvmlReturn_t nvmlDeviceGetConfComputeGpuAttestationReport(nvmlDevice_t device, nvmlConfComputeGpuAttestationReport_t* gpuAtstReport) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetConfComputeGpuAttestationReport(device, gpuAtstReport) + + +cdef nvmlReturn_t nvmlSystemGetConfComputeKeyRotationThresholdInfo(nvmlConfComputeGetKeyRotationThresholdInfo_t* pKeyRotationThrInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetConfComputeKeyRotationThresholdInfo(pKeyRotationThrInfo) + + +cdef nvmlReturn_t nvmlDeviceSetConfComputeUnprotectedMemSize(nvmlDevice_t device, unsigned long long sizeKiB) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetConfComputeUnprotectedMemSize(device, sizeKiB) + + +cdef nvmlReturn_t nvmlSystemSetConfComputeGpusReadyState(unsigned int isAcceptingWork) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemSetConfComputeGpusReadyState(isAcceptingWork) + + +cdef nvmlReturn_t nvmlSystemSetConfComputeKeyRotationThresholdInfo(nvmlConfComputeSetKeyRotationThresholdInfo_t* pKeyRotationThrInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemSetConfComputeKeyRotationThresholdInfo(pKeyRotationThrInfo) + + +cdef nvmlReturn_t nvmlSystemGetConfComputeSettings(nvmlSystemConfComputeSettings_t* settings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetConfComputeSettings(settings) + + +cdef nvmlReturn_t nvmlDeviceGetGspFirmwareVersion(nvmlDevice_t device, char* version) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGspFirmwareVersion(device, version) + + +cdef nvmlReturn_t nvmlDeviceGetGspFirmwareMode(nvmlDevice_t device, unsigned int* isEnabled, unsigned int* defaultMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGspFirmwareMode(device, isEnabled, defaultMode) + + +cdef nvmlReturn_t nvmlDeviceGetSramEccErrorStatus(nvmlDevice_t device, nvmlEccSramErrorStatus_t* status) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetSramEccErrorStatus(device, status) + + +cdef nvmlReturn_t nvmlDeviceGetAccountingMode(nvmlDevice_t device, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetAccountingMode(device, mode) + + +cdef nvmlReturn_t nvmlDeviceGetAccountingStats(nvmlDevice_t device, unsigned int pid, nvmlAccountingStats_t* stats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetAccountingStats(device, pid, stats) + + +cdef nvmlReturn_t nvmlDeviceGetAccountingPids(nvmlDevice_t device, unsigned int* count, unsigned int* pids) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetAccountingPids(device, count, pids) + + +cdef nvmlReturn_t nvmlDeviceGetAccountingBufferSize(nvmlDevice_t device, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetAccountingBufferSize(device, bufferSize) + + +cdef nvmlReturn_t nvmlDeviceGetRetiredPages(nvmlDevice_t device, nvmlPageRetirementCause_t cause, unsigned int* pageCount, unsigned long long* addresses) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetRetiredPages(device, cause, pageCount, addresses) + + +cdef nvmlReturn_t nvmlDeviceGetRetiredPages_v2(nvmlDevice_t device, nvmlPageRetirementCause_t cause, unsigned int* pageCount, unsigned long long* addresses, unsigned long long* timestamps) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetRetiredPages_v2(device, cause, pageCount, addresses, timestamps) + + +cdef nvmlReturn_t nvmlDeviceGetRetiredPagesPendingStatus(nvmlDevice_t device, nvmlEnableState_t* isPending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetRetiredPagesPendingStatus(device, isPending) + + +cdef nvmlReturn_t nvmlDeviceGetRemappedRows(nvmlDevice_t device, unsigned int* corrRows, unsigned int* uncRows, unsigned int* isPending, unsigned int* failureOccurred) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetRemappedRows(device, corrRows, uncRows, isPending, failureOccurred) + + +cdef nvmlReturn_t nvmlDeviceGetRowRemapperHistogram(nvmlDevice_t device, nvmlRowRemapperHistogramValues_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetRowRemapperHistogram(device, values) + + +cdef nvmlReturn_t nvmlDeviceGetArchitecture(nvmlDevice_t device, nvmlDeviceArchitecture_t* arch) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetArchitecture(device, arch) + + +cdef nvmlReturn_t nvmlDeviceGetClkMonStatus(nvmlDevice_t device, nvmlClkMonStatus_t* status) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetClkMonStatus(device, status) + + +cdef nvmlReturn_t nvmlDeviceGetProcessUtilization(nvmlDevice_t device, nvmlProcessUtilizationSample_t* utilization, unsigned int* processSamplesCount, unsigned long long lastSeenTimeStamp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetProcessUtilization(device, utilization, processSamplesCount, lastSeenTimeStamp) + + +cdef nvmlReturn_t nvmlDeviceGetProcessesUtilizationInfo(nvmlDevice_t device, nvmlProcessesUtilizationInfo_t* procesesUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetProcessesUtilizationInfo(device, procesesUtilInfo) + + +cdef nvmlReturn_t nvmlDeviceGetPlatformInfo(nvmlDevice_t device, nvmlPlatformInfo_t* platformInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPlatformInfo(device, platformInfo) + + +cdef nvmlReturn_t nvmlUnitSetLedState(nvmlUnit_t unit, nvmlLedColor_t color) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlUnitSetLedState(unit, color) + + +cdef nvmlReturn_t nvmlDeviceSetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetPersistenceMode(device, mode) + + +cdef nvmlReturn_t nvmlDeviceSetComputeMode(nvmlDevice_t device, nvmlComputeMode_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetComputeMode(device, mode) + + +cdef nvmlReturn_t nvmlDeviceSetEccMode(nvmlDevice_t device, nvmlEnableState_t ecc) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetEccMode(device, ecc) + + +cdef nvmlReturn_t nvmlDeviceClearEccErrorCounts(nvmlDevice_t device, nvmlEccCounterType_t counterType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceClearEccErrorCounts(device, counterType) + + +cdef nvmlReturn_t nvmlDeviceSetDriverModel(nvmlDevice_t device, nvmlDriverModel_t driverModel, unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetDriverModel(device, driverModel, flags) + + +cdef nvmlReturn_t nvmlDeviceSetGpuLockedClocks(nvmlDevice_t device, unsigned int minGpuClockMHz, unsigned int maxGpuClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetGpuLockedClocks(device, minGpuClockMHz, maxGpuClockMHz) + + +cdef nvmlReturn_t nvmlDeviceResetGpuLockedClocks(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceResetGpuLockedClocks(device) + + +cdef nvmlReturn_t nvmlDeviceSetMemoryLockedClocks(nvmlDevice_t device, unsigned int minMemClockMHz, unsigned int maxMemClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetMemoryLockedClocks(device, minMemClockMHz, maxMemClockMHz) + + +cdef nvmlReturn_t nvmlDeviceResetMemoryLockedClocks(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceResetMemoryLockedClocks(device) + + +cdef nvmlReturn_t nvmlDeviceSetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetAutoBoostedClocksEnabled(device, enabled) + + +cdef nvmlReturn_t nvmlDeviceSetDefaultAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled, unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetDefaultAutoBoostedClocksEnabled(device, enabled, flags) + + +cdef nvmlReturn_t nvmlDeviceSetDefaultFanSpeed_v2(nvmlDevice_t device, unsigned int fan) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetDefaultFanSpeed_v2(device, fan) + + +cdef nvmlReturn_t nvmlDeviceSetFanControlPolicy(nvmlDevice_t device, unsigned int fan, nvmlFanControlPolicy_t policy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetFanControlPolicy(device, fan, policy) + + +cdef nvmlReturn_t nvmlDeviceSetTemperatureThreshold(nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetTemperatureThreshold(device, thresholdType, temp) + + +cdef nvmlReturn_t nvmlDeviceSetPowerManagementLimit(nvmlDevice_t device, unsigned int limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetPowerManagementLimit(device, limit) + + +cdef nvmlReturn_t nvmlDeviceSetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetGpuOperationMode(device, mode) + + +cdef nvmlReturn_t nvmlDeviceSetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t isRestricted) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetAPIRestriction(device, apiType, isRestricted) + + +cdef nvmlReturn_t nvmlDeviceSetFanSpeed_v2(nvmlDevice_t device, unsigned int fan, unsigned int speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetFanSpeed_v2(device, fan, speed) + + +cdef nvmlReturn_t nvmlDeviceSetAccountingMode(nvmlDevice_t device, nvmlEnableState_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetAccountingMode(device, mode) + + +cdef nvmlReturn_t nvmlDeviceClearAccountingPids(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceClearAccountingPids(device) + + +cdef nvmlReturn_t nvmlDeviceSetPowerManagementLimit_v2(nvmlDevice_t device, nvmlPowerValue_v2_t* powerValue) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetPowerManagementLimit_v2(device, powerValue) + + +cdef nvmlReturn_t nvmlDeviceGetNvLinkState(nvmlDevice_t device, unsigned int link, nvmlEnableState_t* isActive) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNvLinkState(device, link, isActive) + + +cdef nvmlReturn_t nvmlDeviceGetNvLinkVersion(nvmlDevice_t device, unsigned int link, unsigned int* version) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNvLinkVersion(device, link, version) + + +cdef nvmlReturn_t nvmlDeviceGetNvLinkCapability(nvmlDevice_t device, unsigned int link, nvmlNvLinkCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNvLinkCapability(device, link, capability, capResult) + + +cdef nvmlReturn_t nvmlDeviceGetNvLinkRemotePciInfo_v2(nvmlDevice_t device, unsigned int link, nvmlPciInfo_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNvLinkRemotePciInfo_v2(device, link, pci) + + +cdef nvmlReturn_t nvmlDeviceGetNvLinkErrorCounter(nvmlDevice_t device, unsigned int link, nvmlNvLinkErrorCounter_t counter, unsigned long long* counterValue) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNvLinkErrorCounter(device, link, counter, counterValue) + + +cdef nvmlReturn_t nvmlDeviceResetNvLinkErrorCounters(nvmlDevice_t device, unsigned int link) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceResetNvLinkErrorCounters(device, link) + + +cdef nvmlReturn_t nvmlDeviceGetNvLinkRemoteDeviceType(nvmlDevice_t device, unsigned int link, nvmlIntNvLinkDeviceType_t* pNvLinkDeviceType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNvLinkRemoteDeviceType(device, link, pNvLinkDeviceType) + + +cdef nvmlReturn_t nvmlDeviceSetNvLinkDeviceLowPowerThreshold(nvmlDevice_t device, nvmlNvLinkPowerThres_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetNvLinkDeviceLowPowerThreshold(device, info) + + +cdef nvmlReturn_t nvmlSystemSetNvlinkBwMode(unsigned int nvlinkBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemSetNvlinkBwMode(nvlinkBwMode) + + +cdef nvmlReturn_t nvmlSystemGetNvlinkBwMode(unsigned int* nvlinkBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetNvlinkBwMode(nvlinkBwMode) + + +cdef nvmlReturn_t nvmlDeviceGetNvlinkSupportedBwModes(nvmlDevice_t device, nvmlNvlinkSupportedBwModes_t* supportedBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNvlinkSupportedBwModes(device, supportedBwMode) + + +cdef nvmlReturn_t nvmlDeviceGetNvlinkBwMode(nvmlDevice_t device, nvmlNvlinkGetBwMode_t* getBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNvlinkBwMode(device, getBwMode) + + +cdef nvmlReturn_t nvmlDeviceSetNvlinkBwMode(nvmlDevice_t device, nvmlNvlinkSetBwMode_t* setBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetNvlinkBwMode(device, setBwMode) + + +cdef nvmlReturn_t nvmlEventSetCreate(nvmlEventSet_t* set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlEventSetCreate(set) + + +cdef nvmlReturn_t nvmlDeviceRegisterEvents(nvmlDevice_t device, unsigned long long eventTypes, nvmlEventSet_t set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceRegisterEvents(device, eventTypes, set) + + +cdef nvmlReturn_t nvmlDeviceGetSupportedEventTypes(nvmlDevice_t device, unsigned long long* eventTypes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetSupportedEventTypes(device, eventTypes) + + +cdef nvmlReturn_t nvmlEventSetWait_v2(nvmlEventSet_t set, nvmlEventData_t* data, unsigned int timeoutms) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlEventSetWait_v2(set, data, timeoutms) + + +cdef nvmlReturn_t nvmlEventSetFree(nvmlEventSet_t set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlEventSetFree(set) + + +cdef nvmlReturn_t nvmlSystemEventSetCreate(nvmlSystemEventSetCreateRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemEventSetCreate(request) + + +cdef nvmlReturn_t nvmlSystemEventSetFree(nvmlSystemEventSetFreeRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemEventSetFree(request) + + +cdef nvmlReturn_t nvmlSystemRegisterEvents(nvmlSystemRegisterEventRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemRegisterEvents(request) + + +cdef nvmlReturn_t nvmlSystemEventSetWait(nvmlSystemEventSetWaitRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemEventSetWait(request) + + +cdef nvmlReturn_t nvmlDeviceModifyDrainState(nvmlPciInfo_t* pciInfo, nvmlEnableState_t newState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceModifyDrainState(pciInfo, newState) + + +cdef nvmlReturn_t nvmlDeviceQueryDrainState(nvmlPciInfo_t* pciInfo, nvmlEnableState_t* currentState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceQueryDrainState(pciInfo, currentState) + + +cdef nvmlReturn_t nvmlDeviceRemoveGpu_v2(nvmlPciInfo_t* pciInfo, nvmlDetachGpuState_t gpuState, nvmlPcieLinkState_t linkState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceRemoveGpu_v2(pciInfo, gpuState, linkState) + + +cdef nvmlReturn_t nvmlDeviceDiscoverGpus(nvmlPciInfo_t* pciInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceDiscoverGpus(pciInfo) + + +cdef nvmlReturn_t nvmlDeviceGetFieldValues(nvmlDevice_t device, int valuesCount, nvmlFieldValue_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetFieldValues(device, valuesCount, values) + + +cdef nvmlReturn_t nvmlDeviceClearFieldValues(nvmlDevice_t device, int valuesCount, nvmlFieldValue_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceClearFieldValues(device, valuesCount, values) + + +cdef nvmlReturn_t nvmlDeviceGetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t* pVirtualMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVirtualizationMode(device, pVirtualMode) + + +cdef nvmlReturn_t nvmlDeviceGetHostVgpuMode(nvmlDevice_t device, nvmlHostVgpuMode_t* pHostVgpuMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetHostVgpuMode(device, pHostVgpuMode) + + +cdef nvmlReturn_t nvmlDeviceSetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t virtualMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetVirtualizationMode(device, virtualMode) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuHeterogeneousMode(nvmlDevice_t device, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuHeterogeneousMode(device, pHeterogeneousMode) + + +cdef nvmlReturn_t nvmlDeviceSetVgpuHeterogeneousMode(nvmlDevice_t device, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetVgpuHeterogeneousMode(device, pHeterogeneousMode) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetPlacementId(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuPlacementId_t* pPlacement) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetPlacementId(vgpuInstance, pPlacement) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuTypeSupportedPlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuTypeSupportedPlacements(device, vgpuTypeId, pPlacementList) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuTypeCreatablePlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuTypeCreatablePlacements(device, vgpuTypeId, pPlacementList) + + +cdef nvmlReturn_t nvmlVgpuTypeGetGspHeapSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* gspHeapSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetGspHeapSize(vgpuTypeId, gspHeapSize) + + +cdef nvmlReturn_t nvmlVgpuTypeGetFbReservation(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbReservation) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetFbReservation(vgpuTypeId, fbReservation) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetRuntimeStateSize(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuRuntimeState_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetRuntimeStateSize(vgpuInstance, pState) + + +cdef nvmlReturn_t nvmlDeviceSetVgpuCapabilities(nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, nvmlEnableState_t state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetVgpuCapabilities(device, capability, state) + + +cdef nvmlReturn_t nvmlDeviceGetGridLicensableFeatures_v4(nvmlDevice_t device, nvmlGridLicensableFeatures_t* pGridLicensableFeatures) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGridLicensableFeatures_v4(device, pGridLicensableFeatures) + + +cdef nvmlReturn_t nvmlGetVgpuDriverCapabilities(nvmlVgpuDriverCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGetVgpuDriverCapabilities(capability, capResult) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuCapabilities(nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuCapabilities(device, capability, capResult) + + +cdef nvmlReturn_t nvmlDeviceGetSupportedVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuTypeId_t* vgpuTypeIds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetSupportedVgpus(device, vgpuCount, vgpuTypeIds) + + +cdef nvmlReturn_t nvmlDeviceGetCreatableVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuTypeId_t* vgpuTypeIds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCreatableVgpus(device, vgpuCount, vgpuTypeIds) + + +cdef nvmlReturn_t nvmlVgpuTypeGetClass(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeClass, unsigned int* size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetClass(vgpuTypeId, vgpuTypeClass, size) + + +cdef nvmlReturn_t nvmlVgpuTypeGetName(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeName, unsigned int* size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetName(vgpuTypeId, vgpuTypeName, size) + + +cdef nvmlReturn_t nvmlVgpuTypeGetGpuInstanceProfileId(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* gpuInstanceProfileId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetGpuInstanceProfileId(vgpuTypeId, gpuInstanceProfileId) + + +cdef nvmlReturn_t nvmlVgpuTypeGetDeviceID(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* deviceID, unsigned long long* subsystemID) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetDeviceID(vgpuTypeId, deviceID, subsystemID) + + +cdef nvmlReturn_t nvmlVgpuTypeGetFramebufferSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetFramebufferSize(vgpuTypeId, fbSize) + + +cdef nvmlReturn_t nvmlVgpuTypeGetNumDisplayHeads(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* numDisplayHeads) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetNumDisplayHeads(vgpuTypeId, numDisplayHeads) + + +cdef nvmlReturn_t nvmlVgpuTypeGetResolution(nvmlVgpuTypeId_t vgpuTypeId, unsigned int displayIndex, unsigned int* xdim, unsigned int* ydim) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetResolution(vgpuTypeId, displayIndex, xdim, ydim) + + +cdef nvmlReturn_t nvmlVgpuTypeGetLicense(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeLicenseString, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetLicense(vgpuTypeId, vgpuTypeLicenseString, size) + + +cdef nvmlReturn_t nvmlVgpuTypeGetFrameRateLimit(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* frameRateLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetFrameRateLimit(vgpuTypeId, frameRateLimit) + + +cdef nvmlReturn_t nvmlVgpuTypeGetMaxInstances(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, unsigned int* vgpuInstanceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetMaxInstances(device, vgpuTypeId, vgpuInstanceCount) + + +cdef nvmlReturn_t nvmlVgpuTypeGetMaxInstancesPerVm(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* vgpuInstanceCountPerVm) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetMaxInstancesPerVm(vgpuTypeId, vgpuInstanceCountPerVm) + + +cdef nvmlReturn_t nvmlVgpuTypeGetBAR1Info(nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuTypeBar1Info_t* bar1Info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetBAR1Info(vgpuTypeId, bar1Info) + + +cdef nvmlReturn_t nvmlDeviceGetActiveVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuInstance_t* vgpuInstances) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetActiveVgpus(device, vgpuCount, vgpuInstances) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetVmID(nvmlVgpuInstance_t vgpuInstance, char* vmId, unsigned int size, nvmlVgpuVmIdType_t* vmIdType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetVmID(vgpuInstance, vmId, size, vmIdType) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetUUID(nvmlVgpuInstance_t vgpuInstance, char* uuid, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetUUID(vgpuInstance, uuid, size) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetVmDriverVersion(nvmlVgpuInstance_t vgpuInstance, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetVmDriverVersion(vgpuInstance, version, length) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetFbUsage(nvmlVgpuInstance_t vgpuInstance, unsigned long long* fbUsage) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetFbUsage(vgpuInstance, fbUsage) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetLicenseStatus(nvmlVgpuInstance_t vgpuInstance, unsigned int* licensed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetLicenseStatus(vgpuInstance, licensed) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetType(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuTypeId_t* vgpuTypeId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetType(vgpuInstance, vgpuTypeId) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetFrameRateLimit(nvmlVgpuInstance_t vgpuInstance, unsigned int* frameRateLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetFrameRateLimit(vgpuInstance, frameRateLimit) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetEccMode(nvmlVgpuInstance_t vgpuInstance, nvmlEnableState_t* eccMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetEccMode(vgpuInstance, eccMode) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int* encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetEncoderCapacity(vgpuInstance, encoderCapacity) + + +cdef nvmlReturn_t nvmlVgpuInstanceSetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceSetEncoderCapacity(vgpuInstance, encoderCapacity) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetEncoderStats(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, unsigned int* averageFps, unsigned int* averageLatency) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetEncoderStats(vgpuInstance, sessionCount, averageFps, averageLatency) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetEncoderSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, nvmlEncoderSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetEncoderSessions(vgpuInstance, sessionCount, sessionInfo) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetFBCStats(nvmlVgpuInstance_t vgpuInstance, nvmlFBCStats_t* fbcStats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetFBCStats(vgpuInstance, fbcStats) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetFBCSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, nvmlFBCSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetFBCSessions(vgpuInstance, sessionCount, sessionInfo) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetGpuInstanceId(nvmlVgpuInstance_t vgpuInstance, unsigned int* gpuInstanceId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetGpuInstanceId(vgpuInstance, gpuInstanceId) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetGpuPciId(nvmlVgpuInstance_t vgpuInstance, char* vgpuPciId, unsigned int* length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetGpuPciId(vgpuInstance, vgpuPciId, length) + + +cdef nvmlReturn_t nvmlVgpuTypeGetCapabilities(nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetCapabilities(vgpuTypeId, capability, capResult) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetMdevUUID(nvmlVgpuInstance_t vgpuInstance, char* mdevUuid, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetMdevUUID(vgpuInstance, mdevUuid, size) + + +cdef nvmlReturn_t nvmlGpuInstanceGetCreatableVgpus(nvmlGpuInstance_t gpuInstance, nvmlVgpuTypeIdInfo_t* pVgpus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetCreatableVgpus(gpuInstance, pVgpus) + + +cdef nvmlReturn_t nvmlVgpuTypeGetMaxInstancesPerGpuInstance(nvmlVgpuTypeMaxInstance_t* pMaxInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetMaxInstancesPerGpuInstance(pMaxInstance) + + +cdef nvmlReturn_t nvmlGpuInstanceGetActiveVgpus(nvmlGpuInstance_t gpuInstance, nvmlActiveVgpuInstanceInfo_t* pVgpuInstanceInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetActiveVgpus(gpuInstance, pVgpuInstanceInfo) + + +cdef nvmlReturn_t nvmlGpuInstanceSetVgpuSchedulerState(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerState_t* pScheduler) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceSetVgpuSchedulerState(gpuInstance, pScheduler) + + +cdef nvmlReturn_t nvmlGpuInstanceGetVgpuSchedulerState(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerStateInfo_t* pSchedulerStateInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetVgpuSchedulerState(gpuInstance, pSchedulerStateInfo) + + +cdef nvmlReturn_t nvmlGpuInstanceGetVgpuSchedulerLog(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerLogInfo_t* pSchedulerLogInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetVgpuSchedulerLog(gpuInstance, pSchedulerLogInfo) + + +cdef nvmlReturn_t nvmlGpuInstanceGetVgpuTypeCreatablePlacements(nvmlGpuInstance_t gpuInstance, nvmlVgpuCreatablePlacementInfo_t* pCreatablePlacementInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetVgpuTypeCreatablePlacements(gpuInstance, pCreatablePlacementInfo) + + +cdef nvmlReturn_t nvmlGpuInstanceGetVgpuHeterogeneousMode(nvmlGpuInstance_t gpuInstance, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetVgpuHeterogeneousMode(gpuInstance, pHeterogeneousMode) + + +cdef nvmlReturn_t nvmlGpuInstanceSetVgpuHeterogeneousMode(nvmlGpuInstance_t gpuInstance, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceSetVgpuHeterogeneousMode(gpuInstance, pHeterogeneousMode) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetMetadata(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuMetadata_t* vgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetMetadata(vgpuInstance, vgpuMetadata, bufferSize) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuMetadata(nvmlDevice_t device, nvmlVgpuPgpuMetadata_t* pgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuMetadata(device, pgpuMetadata, bufferSize) + + +cdef nvmlReturn_t nvmlGetVgpuCompatibility(nvmlVgpuMetadata_t* vgpuMetadata, nvmlVgpuPgpuMetadata_t* pgpuMetadata, nvmlVgpuPgpuCompatibility_t* compatibilityInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGetVgpuCompatibility(vgpuMetadata, pgpuMetadata, compatibilityInfo) + + +cdef nvmlReturn_t nvmlDeviceGetPgpuMetadataString(nvmlDevice_t device, char* pgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPgpuMetadataString(device, pgpuMetadata, bufferSize) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuSchedulerLog(nvmlDevice_t device, nvmlVgpuSchedulerLog_t* pSchedulerLog) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuSchedulerLog(device, pSchedulerLog) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuSchedulerState(nvmlDevice_t device, nvmlVgpuSchedulerGetState_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuSchedulerState(device, pSchedulerState) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuSchedulerCapabilities(nvmlDevice_t device, nvmlVgpuSchedulerCapabilities_t* pCapabilities) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuSchedulerCapabilities(device, pCapabilities) + + +cdef nvmlReturn_t nvmlDeviceSetVgpuSchedulerState(nvmlDevice_t device, nvmlVgpuSchedulerSetState_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetVgpuSchedulerState(device, pSchedulerState) + + +cdef nvmlReturn_t nvmlGetVgpuVersion(nvmlVgpuVersion_t* supported, nvmlVgpuVersion_t* current) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGetVgpuVersion(supported, current) + + +cdef nvmlReturn_t nvmlSetVgpuVersion(nvmlVgpuVersion_t* vgpuVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSetVgpuVersion(vgpuVersion) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, nvmlValueType_t* sampleValType, unsigned int* vgpuInstanceSamplesCount, nvmlVgpuInstanceUtilizationSample_t* utilizationSamples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuUtilization(device, lastSeenTimeStamp, sampleValType, vgpuInstanceSamplesCount, utilizationSamples) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuInstancesUtilizationInfo(nvmlDevice_t device, nvmlVgpuInstancesUtilizationInfo_t* vgpuUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuInstancesUtilizationInfo(device, vgpuUtilInfo) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuProcessUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, unsigned int* vgpuProcessSamplesCount, nvmlVgpuProcessUtilizationSample_t* utilizationSamples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuProcessUtilization(device, lastSeenTimeStamp, vgpuProcessSamplesCount, utilizationSamples) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuProcessesUtilizationInfo(nvmlDevice_t device, nvmlVgpuProcessesUtilizationInfo_t* vgpuProcUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuProcessesUtilizationInfo(device, vgpuProcUtilInfo) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetAccountingMode(nvmlVgpuInstance_t vgpuInstance, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetAccountingMode(vgpuInstance, mode) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetAccountingPids(nvmlVgpuInstance_t vgpuInstance, unsigned int* count, unsigned int* pids) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetAccountingPids(vgpuInstance, count, pids) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetAccountingStats(nvmlVgpuInstance_t vgpuInstance, unsigned int pid, nvmlAccountingStats_t* stats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetAccountingStats(vgpuInstance, pid, stats) + + +cdef nvmlReturn_t nvmlVgpuInstanceClearAccountingPids(nvmlVgpuInstance_t vgpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceClearAccountingPids(vgpuInstance) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetLicenseInfo_v2(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuLicenseInfo_t* licenseInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetLicenseInfo_v2(vgpuInstance, licenseInfo) + + +cdef nvmlReturn_t nvmlGetExcludedDeviceCount(unsigned int* deviceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGetExcludedDeviceCount(deviceCount) + + +cdef nvmlReturn_t nvmlGetExcludedDeviceInfoByIndex(unsigned int index, nvmlExcludedDeviceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGetExcludedDeviceInfoByIndex(index, info) + + +cdef nvmlReturn_t nvmlDeviceSetMigMode(nvmlDevice_t device, unsigned int mode, nvmlReturn_t* activationStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetMigMode(device, mode, activationStatus) + + +cdef nvmlReturn_t nvmlDeviceGetMigMode(nvmlDevice_t device, unsigned int* currentMode, unsigned int* pendingMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMigMode(device, currentMode, pendingMode) + + +cdef nvmlReturn_t nvmlDeviceGetGpuInstanceProfileInfoV(nvmlDevice_t device, unsigned int profile, nvmlGpuInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpuInstanceProfileInfoV(device, profile, info) + + +cdef nvmlReturn_t nvmlDeviceGetGpuInstancePossiblePlacements_v2(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstancePlacement_t* placements, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpuInstancePossiblePlacements_v2(device, profileId, placements, count) + + +cdef nvmlReturn_t nvmlDeviceGetGpuInstanceRemainingCapacity(nvmlDevice_t device, unsigned int profileId, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpuInstanceRemainingCapacity(device, profileId, count) + + +cdef nvmlReturn_t nvmlDeviceCreateGpuInstance(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceCreateGpuInstance(device, profileId, gpuInstance) + + +cdef nvmlReturn_t nvmlDeviceCreateGpuInstanceWithPlacement(nvmlDevice_t device, unsigned int profileId, const nvmlGpuInstancePlacement_t* placement, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceCreateGpuInstanceWithPlacement(device, profileId, placement, gpuInstance) + + +cdef nvmlReturn_t nvmlGpuInstanceDestroy(nvmlGpuInstance_t gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceDestroy(gpuInstance) + + +cdef nvmlReturn_t nvmlDeviceGetGpuInstances(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t* gpuInstances, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpuInstances(device, profileId, gpuInstances, count) + + +cdef nvmlReturn_t nvmlDeviceGetGpuInstanceById(nvmlDevice_t device, unsigned int id, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpuInstanceById(device, id, gpuInstance) + + +cdef nvmlReturn_t nvmlGpuInstanceGetInfo(nvmlGpuInstance_t gpuInstance, nvmlGpuInstanceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetInfo(gpuInstance, info) + + +cdef nvmlReturn_t nvmlGpuInstanceGetComputeInstanceProfileInfoV(nvmlGpuInstance_t gpuInstance, unsigned int profile, unsigned int engProfile, nvmlComputeInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetComputeInstanceProfileInfoV(gpuInstance, profile, engProfile, info) + + +cdef nvmlReturn_t nvmlGpuInstanceGetComputeInstanceRemainingCapacity(nvmlGpuInstance_t gpuInstance, unsigned int profileId, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetComputeInstanceRemainingCapacity(gpuInstance, profileId, count) + + +cdef nvmlReturn_t nvmlGpuInstanceGetComputeInstancePossiblePlacements(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstancePlacement_t* placements, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetComputeInstancePossiblePlacements(gpuInstance, profileId, placements, count) + + +cdef nvmlReturn_t nvmlGpuInstanceCreateComputeInstance(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceCreateComputeInstance(gpuInstance, profileId, computeInstance) + + +cdef nvmlReturn_t nvmlGpuInstanceCreateComputeInstanceWithPlacement(nvmlGpuInstance_t gpuInstance, unsigned int profileId, const nvmlComputeInstancePlacement_t* placement, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceCreateComputeInstanceWithPlacement(gpuInstance, profileId, placement, computeInstance) + + +cdef nvmlReturn_t nvmlComputeInstanceDestroy(nvmlComputeInstance_t computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlComputeInstanceDestroy(computeInstance) + + +cdef nvmlReturn_t nvmlGpuInstanceGetComputeInstances(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t* computeInstances, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetComputeInstances(gpuInstance, profileId, computeInstances, count) + + +cdef nvmlReturn_t nvmlGpuInstanceGetComputeInstanceById(nvmlGpuInstance_t gpuInstance, unsigned int id, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetComputeInstanceById(gpuInstance, id, computeInstance) + + +cdef nvmlReturn_t nvmlComputeInstanceGetInfo_v2(nvmlComputeInstance_t computeInstance, nvmlComputeInstanceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlComputeInstanceGetInfo_v2(computeInstance, info) + + +cdef nvmlReturn_t nvmlDeviceIsMigDeviceHandle(nvmlDevice_t device, unsigned int* isMigDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceIsMigDeviceHandle(device, isMigDevice) + + +cdef nvmlReturn_t nvmlDeviceGetGpuInstanceId(nvmlDevice_t device, unsigned int* id) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpuInstanceId(device, id) + + +cdef nvmlReturn_t nvmlDeviceGetComputeInstanceId(nvmlDevice_t device, unsigned int* id) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetComputeInstanceId(device, id) + + +cdef nvmlReturn_t nvmlDeviceGetMaxMigDeviceCount(nvmlDevice_t device, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMaxMigDeviceCount(device, count) + + +cdef nvmlReturn_t nvmlDeviceGetMigDeviceHandleByIndex(nvmlDevice_t device, unsigned int index, nvmlDevice_t* migDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMigDeviceHandleByIndex(device, index, migDevice) + + +cdef nvmlReturn_t nvmlDeviceGetDeviceHandleFromMigDeviceHandle(nvmlDevice_t migDevice, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetDeviceHandleFromMigDeviceHandle(migDevice, device) + + +cdef nvmlReturn_t nvmlGpmSampleGet(nvmlDevice_t device, nvmlGpmSample_t gpmSample) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpmSampleGet(device, gpmSample) + + +cdef nvmlReturn_t nvmlGpmMigSampleGet(nvmlDevice_t device, unsigned int gpuInstanceId, nvmlGpmSample_t gpmSample) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpmMigSampleGet(device, gpuInstanceId, gpmSample) + + +cdef nvmlReturn_t nvmlGpmQueryDeviceSupport(nvmlDevice_t device, nvmlGpmSupport_t* gpmSupport) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpmQueryDeviceSupport(device, gpmSupport) + + +cdef nvmlReturn_t nvmlGpmQueryIfStreamingEnabled(nvmlDevice_t device, unsigned int* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpmQueryIfStreamingEnabled(device, state) + + +cdef nvmlReturn_t nvmlGpmSetStreamingEnabled(nvmlDevice_t device, unsigned int state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpmSetStreamingEnabled(device, state) + + +cdef nvmlReturn_t nvmlDeviceGetCapabilities(nvmlDevice_t device, nvmlDeviceCapabilities_t* caps) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCapabilities(device, caps) + + +cdef nvmlReturn_t nvmlDeviceWorkloadPowerProfileClearRequestedProfiles(nvmlDevice_t device, nvmlWorkloadPowerProfileRequestedProfiles_t* requestedProfiles) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceWorkloadPowerProfileClearRequestedProfiles(device, requestedProfiles) + + +cdef nvmlReturn_t nvmlDevicePowerSmoothingActivatePresetProfile(nvmlDevice_t device, nvmlPowerSmoothingProfile_t* profile) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDevicePowerSmoothingActivatePresetProfile(device, profile) + + +cdef nvmlReturn_t nvmlDevicePowerSmoothingUpdatePresetProfileParam(nvmlDevice_t device, nvmlPowerSmoothingProfile_t* profile) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDevicePowerSmoothingUpdatePresetProfileParam(device, profile) + + +cdef nvmlReturn_t nvmlDevicePowerSmoothingSetState(nvmlDevice_t device, nvmlPowerSmoothingState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDevicePowerSmoothingSetState(device, state) + + +cdef nvmlReturn_t nvmlDeviceGetAddressingMode(nvmlDevice_t device, nvmlDeviceAddressingMode_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetAddressingMode(device, mode) + + +cdef nvmlReturn_t nvmlDeviceGetRepairStatus(nvmlDevice_t device, nvmlRepairStatus_t* repairStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetRepairStatus(device, repairStatus) + + +cdef nvmlReturn_t nvmlDeviceGetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t* powerMizerMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPowerMizerMode_v1(device, powerMizerMode) + + +cdef nvmlReturn_t nvmlDeviceSetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t* powerMizerMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetPowerMizerMode_v1(device, powerMizerMode) + + +cdef nvmlReturn_t nvmlDeviceGetPdi(nvmlDevice_t device, nvmlPdi_t* pdi) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPdi(device, pdi) + + +cdef nvmlReturn_t nvmlDeviceSetHostname_v1(nvmlDevice_t device, nvmlHostname_v1_t* hostname) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetHostname_v1(device, hostname) + + +cdef nvmlReturn_t nvmlDeviceGetHostname_v1(nvmlDevice_t device, nvmlHostname_v1_t* hostname) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetHostname_v1(device, hostname) + + +cdef nvmlReturn_t nvmlDeviceGetNvLinkInfo(nvmlDevice_t device, nvmlNvLinkInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNvLinkInfo(device, info) + + +cdef nvmlReturn_t nvmlDeviceReadWritePRM_v1(nvmlDevice_t device, nvmlPRMTLV_v1_t* buffer) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceReadWritePRM_v1(device, buffer) + + +cdef nvmlReturn_t nvmlDeviceGetGpuInstanceProfileInfoByIdV(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpuInstanceProfileInfoByIdV(device, profileId, info) + + +cdef nvmlReturn_t nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(nvmlDevice_t device, nvmlEccSramUniqueUncorrectedErrorCounts_t* errorCounts) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(device, errorCounts) diff --git a/cuda_bindings/cuda/bindings/nvml.pxd b/cuda_bindings/cuda/bindings/nvml.pxd new file mode 100644 index 0000000000..4dcab7ff94 --- /dev/null +++ b/cuda_bindings/cuda/bindings/nvml.pxd @@ -0,0 +1,447 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE +# +# This code was automatically generated across versions from 12.9.1 to 13.0.1. Do not modify it directly. + +from libc.stdint cimport intptr_t + +from .cynvml cimport * + + +############################################################################### +# Types +############################################################################### + +ctypedef nvmlDramEncryptionInfo_v1_t DramEncryptionInfo_v1 +ctypedef nvmlConfComputeSetKeyRotationThresholdInfo_v1_t ConfComputeSetKeyRotationThresholdInfo_v1 +ctypedef nvmlSystemDriverBranchInfo_v1_t SystemDriverBranchInfo_v1 +ctypedef nvmlTemperature_v1_t Temperature_v1 +ctypedef nvmlPowerSmoothingProfile_v1_t PowerSmoothingProfile_v1 +ctypedef nvmlPowerSmoothingState_v1_t PowerSmoothingState_v1 +ctypedef nvmlDevice_t Device +ctypedef nvmlGpuInstance_t GpuInstance +ctypedef nvmlUnit_t Unit +ctypedef nvmlEventSet_t EventSet +ctypedef nvmlSystemEventSet_t SystemEventSet +ctypedef nvmlComputeInstance_t ComputeInstance +ctypedef nvmlGpmSample_t GpmSample +ctypedef nvmlEccErrorCounts_t EccErrorCounts +ctypedef nvmlProcessInfo_v1_t ProcessInfo_v1 +ctypedef nvmlProcessInfo_v2_t ProcessInfo_v2 +ctypedef nvmlNvLinkUtilizationControl_t NvLinkUtilizationControl +ctypedef nvmlViolationTime_t ViolationTime +ctypedef nvmlUUIDValue_t UUIDValue +ctypedef nvmlPlatformInfo_v1_t PlatformInfo_v1 +ctypedef nvmlVgpuPlacementList_v1_t VgpuPlacementList_v1 +ctypedef nvmlNvLinkPowerThres_t NvLinkPowerThres +ctypedef nvmlSystemEventData_v1_t SystemEventData_v1 +ctypedef nvmlGpuInstanceProfileInfo_t GpuInstanceProfileInfo +ctypedef nvmlComputeInstanceProfileInfo_t ComputeInstanceProfileInfo +ctypedef nvmlMask255_t Mask255 +ctypedef nvmlHostname_v1_t Hostname_v1 +ctypedef nvmlNvLinkInfo_v1_t NvLinkInfo_v1 +ctypedef nvmlPowerValue_v2_t PowerValue_v2 +ctypedef nvmlVgpuProcessUtilizationSample_t VgpuProcessUtilizationSample +ctypedef nvmlGpuFabricInfo_t GpuFabricInfo +ctypedef nvmlGpuFabricInfo_v2_t GpuFabricInfo_v2 +ctypedef nvmlSystemEventSetCreateRequest_v1_t SystemEventSetCreateRequest_v1 +ctypedef nvmlSystemEventSetFreeRequest_v1_t SystemEventSetFreeRequest_v1 +ctypedef nvmlSystemRegisterEventRequest_v1_t SystemRegisterEventRequest_v1 +ctypedef nvmlVgpuInstanceUtilizationSample_t VgpuInstanceUtilizationSample +ctypedef nvmlUUID_v1_t UUID_v1 +ctypedef nvmlSystemEventSetWaitRequest_v1_t SystemEventSetWaitRequest_v1 +ctypedef nvmlGpmMetric_t GpmMetric +ctypedef nvmlWorkloadPowerProfileInfo_v1_t WorkloadPowerProfileInfo_v1 +ctypedef nvmlWorkloadPowerProfileCurrentProfiles_v1_t WorkloadPowerProfileCurrentProfiles_v1 +ctypedef nvmlWorkloadPowerProfileRequestedProfiles_v1_t WorkloadPowerProfileRequestedProfiles_v1 +ctypedef nvmlPRMTLV_v1_t PRMTLV_v1 +ctypedef nvmlVgpuSchedulerSetState_t VgpuSchedulerSetState +ctypedef nvmlGpmMetricsGet_t GpmMetricsGet +ctypedef nvmlWorkloadPowerProfileProfilesInfo_v1_t WorkloadPowerProfileProfilesInfo_v1 + + +############################################################################### +# Enum +############################################################################### + +ctypedef nvmlBridgeChipType_t _BridgeChipType +ctypedef nvmlNvLinkUtilizationCountUnits_t _NvLinkUtilizationCountUnits +ctypedef nvmlNvLinkUtilizationCountPktTypes_t _NvLinkUtilizationCountPktTypes +ctypedef nvmlNvLinkCapability_t _NvLinkCapability +ctypedef nvmlNvLinkErrorCounter_t _NvLinkErrorCounter +ctypedef nvmlIntNvLinkDeviceType_t _IntNvLinkDeviceType +ctypedef nvmlGpuTopologyLevel_t _GpuTopologyLevel +ctypedef nvmlGpuP2PStatus_t _GpuP2PStatus +ctypedef nvmlGpuP2PCapsIndex_t _GpuP2PCapsIndex +ctypedef nvmlSamplingType_t _SamplingType +ctypedef nvmlPcieUtilCounter_t _PcieUtilCounter +ctypedef nvmlValueType_t _ValueType +ctypedef nvmlPerfPolicyType_t _PerfPolicyType +ctypedef nvmlThermalTarget_t _ThermalTarget +ctypedef nvmlThermalController_t _ThermalController +ctypedef nvmlCoolerControl_t _CoolerControl +ctypedef nvmlCoolerTarget_t _CoolerTarget +ctypedef nvmlUUIDType_t _UUIDType +ctypedef nvmlEnableState_t _EnableState +ctypedef nvmlBrandType_t _BrandType +ctypedef nvmlTemperatureThresholds_t _TemperatureThresholds +ctypedef nvmlTemperatureSensors_t _TemperatureSensors +ctypedef nvmlComputeMode_t _ComputeMode +ctypedef nvmlMemoryErrorType_t _MemoryErrorType +ctypedef nvmlNvlinkVersion_t _NvlinkVersion +ctypedef nvmlEccCounterType_t _EccCounterType +ctypedef nvmlClockType_t _ClockType +ctypedef nvmlClockId_t _ClockId +ctypedef nvmlDriverModel_t _DriverModel +ctypedef nvmlPstates_t _Pstates +ctypedef nvmlGpuOperationMode_t _GpuOperationMode +ctypedef nvmlInforomObject_t _InforomObject +ctypedef nvmlReturn_t _Return +ctypedef nvmlMemoryLocation_t _MemoryLocation +ctypedef nvmlPageRetirementCause_t _PageRetirementCause +ctypedef nvmlRestrictedAPI_t _RestrictedAPI +ctypedef nvmlGpuUtilizationDomainId_t _GpuUtilizationDomainId +ctypedef nvmlGpuVirtualizationMode_t _GpuVirtualizationMode +ctypedef nvmlHostVgpuMode_t _HostVgpuMode +ctypedef nvmlVgpuVmIdType_t _VgpuVmIdType +ctypedef nvmlVgpuGuestInfoState_t _VgpuGuestInfoState +ctypedef nvmlGridLicenseFeatureCode_t _GridLicenseFeatureCode +ctypedef nvmlVgpuCapability_t _VgpuCapability +ctypedef nvmlVgpuDriverCapability_t _VgpuDriverCapability +ctypedef nvmlDeviceVgpuCapability_t _DeviceVgpuCapability +ctypedef nvmlDeviceGpuRecoveryAction_t _DeviceGpuRecoveryAction +ctypedef nvmlFanState_t _FanState +ctypedef nvmlLedColor_t _LedColor +ctypedef nvmlEncoderType_t _EncoderType +ctypedef nvmlFBCSessionType_t _FBCSessionType +ctypedef nvmlDetachGpuState_t _DetachGpuState +ctypedef nvmlPcieLinkState_t _PcieLinkState +ctypedef nvmlClockLimitId_t _ClockLimitId +ctypedef nvmlVgpuVmCompatibility_t _VgpuVmCompatibility +ctypedef nvmlVgpuPgpuCompatibilityLimitCode_t _VgpuPgpuCompatibilityLimitCode +ctypedef nvmlGpmMetricId_t _GpmMetricId +ctypedef nvmlPowerProfileType_t _PowerProfileType +ctypedef nvmlDeviceAddressingModeType_t _DeviceAddressingModeType + + +############################################################################### +# Functions +############################################################################### + +cpdef init_v2() +cpdef init_with_flags(unsigned int flags) +cpdef shutdown() +cpdef str error_string(int result) +cpdef str system_get_driver_version() +cpdef str system_get_nvml_version() +cpdef int system_get_cuda_driver_version() except * +cpdef int system_get_cuda_driver_version_v2() except 0 +cpdef str system_get_process_name(unsigned int pid) +cpdef object system_get_hic_version() +cpdef unsigned int unit_get_count() except? 0 +cpdef intptr_t unit_get_handle_by_ind_ex(unsigned int ind_ex) except? 0 +cpdef object unit_get_unit_info(intptr_t unit) +cpdef object unit_get_led_state(intptr_t unit) +cpdef object unit_get_psu_info(intptr_t unit) +cpdef unsigned int unit_get_temperature(intptr_t unit, unsigned int type) except? 0 +cpdef object unit_get_fan_speed_info(intptr_t unit) +cpdef unsigned int device_get_count_v2() except? 0 +cpdef object device_get_attributes_v2(intptr_t device) +cpdef intptr_t device_get_handle_by_index_v2(unsigned int ind_ex) except? 0 +cpdef intptr_t device_get_handle_by_serial(serial) except? 0 +cpdef intptr_t device_get_handle_by_uuid(uuid) except? 0 +cpdef intptr_t device_get_handle_by_uuidv(intptr_t uuid) except? 0 +cpdef intptr_t device_get_handle_by_pci_bus_id_v2(pci_bus_id) except? 0 +cpdef str device_get_name(intptr_t device) +cpdef int device_get_brand(intptr_t device) except? -1 +cpdef unsigned int device_get_ind_ex(intptr_t device) except? 0 +cpdef str device_get_serial(intptr_t device) +cpdef unsigned int device_get_module_id(intptr_t device) except? 0 +cpdef object device_get_c2c_mode_info_v(intptr_t device) +cpdef object device_get_memory_affinity(intptr_t device, unsigned int node_set_size, unsigned int scope) +cpdef object device_get_cpu_affinity_within_scope(intptr_t device, unsigned int cpu_set_size, unsigned int scope) +cpdef object device_get_cpu_affinity(intptr_t device, unsigned int cpu_set_size) +cpdef device_set_cpu_affinity(intptr_t device) +cpdef device_clear_cpu_affinity(intptr_t device) +cpdef unsigned int device_get_numa_node_id(intptr_t device) except? 0 +cpdef int device_get_topology_common_ancestor(intptr_t device1, intptr_t device2) except? -1 +cpdef int device_get_p2p_status(intptr_t device1, intptr_t device2, int p2p_ind_ex) except? -1 +cpdef str device_get_uuid(intptr_t device) +cpdef unsigned int device_get_minor_number(intptr_t device) except? 0 +cpdef str device_get_board_part_number(intptr_t device) +cpdef str device_get_inforom_version(intptr_t device, int object) +cpdef str device_get_inforom_image_version(intptr_t device) +cpdef unsigned int device_get_inforom_configuration_checksum(intptr_t device) except? 0 +cpdef device_validate_inforom(intptr_t device) +cpdef unsigned long device_get_last_bbx_flush_time(intptr_t device, intptr_t timestamp) except? 0 +cpdef int device_get_display_mode(intptr_t device) except? -1 +cpdef int device_get_display_active(intptr_t device) except? -1 +cpdef int device_get_persistence_mode(intptr_t device) except? -1 +cpdef object device_get_pci_info_ext(intptr_t device) +cpdef object device_get_pci_info_v3(intptr_t device) +cpdef unsigned int device_get_max_pcie_link_generation(intptr_t device) except? 0 +cpdef unsigned int device_get_gpu_max_pcie_link_generation(intptr_t device) except? 0 +cpdef unsigned int device_get_max_pcie_link_width(intptr_t device) except? 0 +cpdef unsigned int device_get_curr_pcie_link_generation(intptr_t device) except? 0 +cpdef unsigned int device_get_curr_pcie_link_width(intptr_t device) except? 0 +cpdef unsigned int device_get_pcie_throughput(intptr_t device, int counter) except? 0 +cpdef unsigned int device_get_pcie_replay_counter(intptr_t device) except? 0 +cpdef unsigned int device_get_clock_info(intptr_t device, int type) except? 0 +cpdef unsigned int device_get_max_clock_info(intptr_t device, int type) except? 0 +cpdef int device_get_gpc_clk_vf_offset(intptr_t device) except? 0 +cpdef unsigned int device_get_clock(intptr_t device, int clock_type, int clock_id) except? 0 +cpdef unsigned int device_get_max_customer_boost_clock(intptr_t device, int clock_type) except? 0 +cpdef object device_get_supported_memory_clocks(intptr_t device) +cpdef object device_get_supported_graphics_clocks(intptr_t device, unsigned int memory_clock_m_hz) +cpdef tuple device_get_auto_boosted_clocks_enabled(intptr_t device) +cpdef unsigned int device_get_fan_speed(intptr_t device) except? 0 +cpdef unsigned int device_get_fan_speed_v2(intptr_t device, unsigned int fan) except? 0 +cpdef object device_get_fan_speed_rpm(intptr_t device) +cpdef unsigned int device_get_target_fan_speed(intptr_t device, unsigned int fan) except? 0 +cpdef tuple device_get_min_max_fan_speed(intptr_t device) +cpdef unsigned int device_get_fan_control_policy_v2(intptr_t device, unsigned int fan) except * +cpdef unsigned int device_get_num_fans(intptr_t device) except? 0 +cpdef object device_get_cooler_info(intptr_t device) +cpdef unsigned int device_get_temperature_threshold(intptr_t device, int threshold_type) except? 0 +cpdef object device_get_margin_temperature(intptr_t device) +cpdef object device_get_thermal_settings(intptr_t device, unsigned int sensor_ind_ex) +cpdef int device_get_performance_state(intptr_t device) except? -1 +cpdef unsigned long long device_get_current_clocks_event_reasons(intptr_t device) except? 0 +cpdef unsigned long long device_get_supported_clocks_event_reasons(intptr_t device) except? 0 +cpdef int device_get_power_state(intptr_t device) except? -1 +cpdef object device_get_dynamic_pstates_info(intptr_t device) +cpdef int device_get_mem_clk_vf_offset(intptr_t device) except? 0 +cpdef tuple device_get_min_max_clock_of_p_state(intptr_t device, int type, int pstate) +cpdef tuple device_get_gpc_clk_min_max_vf_offset(intptr_t device) +cpdef tuple device_get_mem_clk_min_max_vf_offset(intptr_t device) +cpdef object device_get_clock_offsets(intptr_t device) +cpdef device_set_clock_offsets(intptr_t device, intptr_t info) +cpdef object device_get_performance_modes(intptr_t device) +cpdef object device_get_current_clock_freqs(intptr_t device) +cpdef unsigned int device_get_power_management_limit(intptr_t device) except? 0 +cpdef tuple device_get_power_management_limit_constraints(intptr_t device) +cpdef unsigned int device_get_power_management_default_limit(intptr_t device) except? 0 +cpdef unsigned int device_get_power_usage(intptr_t device) except? 0 +cpdef unsigned long long device_get_total_energy_consumption(intptr_t device) except? 0 +cpdef unsigned int device_get_enforced_power_limit(intptr_t device) except? 0 +cpdef tuple device_get_gpu_operation_mode(intptr_t device) +cpdef object device_get_memory_info_v2(intptr_t device) +cpdef int device_get_compute_mode(intptr_t device) except? -1 +cpdef tuple device_get_cuda_compute_capability(intptr_t device) +cpdef tuple device_get_dram_encryption_mode(intptr_t device) +cpdef device_set_dram_encryption_mode(intptr_t device, intptr_t dram_encryption) +cpdef tuple device_get_ecc_mode(intptr_t device) +cpdef int device_get_default_ecc_mode(intptr_t device) except? -1 +cpdef unsigned int device_get_board_id(intptr_t device) except? 0 +cpdef unsigned int device_get_multi_gpu_board(intptr_t device) except? 0 +cpdef unsigned long long device_get_total_ecc_errors(intptr_t device, int error_type, int counter_type) except? 0 +cpdef unsigned long long device_get_memory_error_counter(intptr_t device, int error_type, int counter_type, int location_type) except? 0 +cpdef object device_get_utilization_rates(intptr_t device) +cpdef tuple device_get_encoder_utilization(intptr_t device) +cpdef unsigned int device_get_encoder_capacity(intptr_t device, int encoder_query_type) except? 0 +cpdef tuple device_get_encoder_stats(intptr_t device) +cpdef object device_get_encoder_sessions(intptr_t device) +cpdef tuple device_get_decoder_utilization(intptr_t device) +cpdef tuple device_get_jpg_utilization(intptr_t device) +cpdef tuple device_get_ofa_utilization(intptr_t device) +cpdef object device_get_fbc_stats(intptr_t device) +cpdef object device_get_fbc_sessions(intptr_t device) +cpdef tuple device_get_driver_model_v2(intptr_t device) +cpdef str device_get_vbios_version(intptr_t device) +cpdef object device_get_bridge_chip_info(intptr_t device) +cpdef object device_get_compute_running_processes_v3(intptr_t device) +cpdef object device_get_mps_compute_running_processes_v3(intptr_t device) +cpdef int device_on_same_board(intptr_t device1, intptr_t device2) except? 0 +cpdef int device_get_api_restriction(intptr_t device, int api_type) except? -1 +cpdef object device_get_bar1_memory_info(intptr_t device) +cpdef unsigned int device_get_irq_num(intptr_t device) except? 0 +cpdef unsigned int device_get_num_gpu_cores(intptr_t device) except? 0 +cpdef unsigned int device_get_power_source(intptr_t device) except * +cpdef unsigned int device_get_memory_bus_width(intptr_t device) except? 0 +cpdef unsigned int device_get_pcie_link_max_speed(intptr_t device) except? 0 +cpdef unsigned int device_get_pcie_speed(intptr_t device) except? 0 +cpdef unsigned int device_get_adaptive_clock_info_status(intptr_t device) except? 0 +cpdef unsigned int device_get_bus_type(intptr_t device) except? 0 +cpdef object device_get_gpu_fabric_info_v(intptr_t device) +cpdef object system_get_conf_compute_capabilities() +cpdef object system_get_conf_compute_state() +cpdef object device_get_conf_compute_mem_size_info(intptr_t device) +cpdef unsigned int system_get_conf_compute_gpus_ready_state() except? 0 +cpdef object device_get_conf_compute_protected_memory_usage(intptr_t device) +cpdef object device_get_conf_compute_gpu_certificate(intptr_t device) +cpdef object device_get_conf_compute_gpu_attestation_report(intptr_t device) +cpdef object system_get_conf_compute_key_rotation_threshold_info() +cpdef device_set_conf_compute_unprotected_mem_size(intptr_t device, unsigned long long size_ki_b) +cpdef system_set_conf_compute_gpus_ready_state(unsigned int is_accepting_work) +cpdef system_set_conf_compute_key_rotation_threshold_info(intptr_t p_key_rotation_thr_info) +cpdef object system_get_conf_compute_settings() +cpdef char device_get_gsp_firmware_version(intptr_t device) except? 0 +cpdef tuple device_get_gsp_firmware_mode(intptr_t device) +cpdef object device_get_sram_ecc_error_status(intptr_t device) +cpdef int device_get_accounting_mode(intptr_t device) except? -1 +cpdef object device_get_accounting_stats(intptr_t device, unsigned int pid) +cpdef object device_get_accounting_pids(intptr_t device) +cpdef unsigned int device_get_accounting_buffer_size(intptr_t device) except? 0 +cpdef object device_get_retired_pages(intptr_t device, int cause) +cpdef int device_get_retired_pages_pending_status(intptr_t device) except? -1 +cpdef tuple device_get_remapped_rows(intptr_t device) +cpdef object device_get_row_remapper_histogram(intptr_t device) +cpdef unsigned int device_get_architecture(intptr_t device) except? 0 +cpdef object device_get_clk_mon_status(intptr_t device) +cpdef object device_get_process_utilization(intptr_t device, unsigned long long last_seen_time_stamp) +cpdef object device_get_platform_info(intptr_t device) +cpdef unit_set_led_state(intptr_t unit, int color) +cpdef device_set_persistence_mode(intptr_t device, int mode) +cpdef device_set_compute_mode(intptr_t device, int mode) +cpdef device_set_ecc_mode(intptr_t device, int ecc) +cpdef device_clear_ecc_error_counts(intptr_t device, int counter_type) +cpdef device_set_driver_model(intptr_t device, int driver_model, unsigned int flags) +cpdef device_set_gpu_locked_clocks(intptr_t device, unsigned int min_gpu_clock_m_hz, unsigned int max_gpu_clock_m_hz) +cpdef device_reset_gpu_locked_clocks(intptr_t device) +cpdef device_set_memory_locked_clocks(intptr_t device, unsigned int min_mem_clock_m_hz, unsigned int max_mem_clock_m_hz) +cpdef device_reset_memory_locked_clocks(intptr_t device) +cpdef device_set_auto_boosted_clocks_enabled(intptr_t device, int enabled) +cpdef device_set_default_auto_boosted_clocks_enabled(intptr_t device, int enabled, unsigned int flags) +cpdef device_set_default_fan_speed_v2(intptr_t device, unsigned int fan) +cpdef device_set_fan_control_policy(intptr_t device, unsigned int fan, unsigned int policy) +cpdef device_set_temperature_threshold(intptr_t device, int threshold_type, intptr_t temp) +cpdef device_set_power_management_limit(intptr_t device, unsigned int limit) +cpdef device_set_gpu_operation_mode(intptr_t device, int mode) +cpdef device_set_api_restriction(intptr_t device, int api_type, int is_restricted) +cpdef device_set_fan_speed_v2(intptr_t device, unsigned int fan, unsigned int speed) +cpdef device_set_accounting_mode(intptr_t device, int mode) +cpdef device_clear_accounting_pids(intptr_t device) +cpdef device_set_power_management_limit_v2(intptr_t device, intptr_t power_value) +cpdef int device_get_nv_link_state(intptr_t device, unsigned int link) except? -1 +cpdef unsigned int device_get_nv_link_version(intptr_t device, unsigned int link) except? 0 +cpdef unsigned int device_get_nv_link_capability(intptr_t device, unsigned int link, int capability) except? 0 +cpdef object device_get_nv_link_remote_pci_info_v2(intptr_t device, unsigned int link) +cpdef unsigned long long device_get_nv_link_error_counter(intptr_t device, unsigned int link, int counter) except? 0 +cpdef device_reset_nv_link_error_counters(intptr_t device, unsigned int link) +cpdef int device_get_nv_link_remote_device_type(intptr_t device, unsigned int link) except? -1 +cpdef device_set_nv_link_device_low_power_threshold(intptr_t device, intptr_t info) +cpdef system_set_nvlink_bw_mode(unsigned int nvlink_bw_mode) +cpdef unsigned int system_get_nvlink_bw_mode() except? 0 +cpdef object device_get_nvlink_supported_bw_modes(intptr_t device) +cpdef object device_get_nvlink_bw_mode(intptr_t device) +cpdef device_set_nvlink_bw_mode(intptr_t device, intptr_t set_bw_mode) +cpdef intptr_t event_set_create() except? 0 +cpdef device_register_events(intptr_t device, unsigned long long event_types, intptr_t set) +cpdef unsigned long long device_get_supported_event_types(intptr_t device) except? 0 +cpdef object event_set_wait_v2(intptr_t set, unsigned int timeoutms) +cpdef event_set_free(intptr_t set) +cpdef system_event_set_create(intptr_t request) +cpdef system_event_set_free(intptr_t request) +cpdef system_register_events(intptr_t request) +cpdef system_event_set_wait(intptr_t request) +cpdef device_modify_drain_state(intptr_t pci_info, int new_state) +cpdef int device_query_drain_state(intptr_t pci_info) except? -1 +cpdef device_remove_gpu_v2(intptr_t pci_info, int gpu_state, int link_state) +cpdef device_discover_gpus(intptr_t pci_info) +cpdef int device_get_virtualization_mode(intptr_t device) except? -1 +cpdef int device_get_host_vgpu_mode(intptr_t device) except? -1 +cpdef device_set_virtualization_mode(intptr_t device, int virtual_mode) +cpdef object device_get_vgpu_heterogeneous_mode(intptr_t device) +cpdef device_set_vgpu_heterogeneous_mode(intptr_t device, intptr_t p_heterogeneous_mode) +cpdef object vgpu_instance_get_placement_id(unsigned int vgpu_instance) +cpdef object device_get_vgpu_type_supported_placements(intptr_t device, unsigned int vgpu_type_id) +cpdef unsigned long long vgpu_type_get_gsp_heap_size(unsigned int vgpu_type_id) except? 0 +cpdef unsigned long long vgpu_type_get_fb_reservation(unsigned int vgpu_type_id) except? 0 +cpdef object vgpu_instance_get_runtime_state_size(unsigned int vgpu_instance) +cpdef device_set_vgpu_capabilities(intptr_t device, int capability, int state) +cpdef object device_get_grid_licensable_features_v4(intptr_t device) +cpdef unsigned int get_vgpu_driver_capabilities(int capability) except? 0 +cpdef unsigned int device_get_vgpu_capabilities(intptr_t device, int capability) except? 0 +cpdef str vgpu_type_get_class(unsigned int vgpu_type_id) +cpdef str vgpu_type_get_name(unsigned int vgpu_type_id) +cpdef unsigned int vgpu_type_get_gpu_instance_profile_id(unsigned int vgpu_type_id) except? 0 +cpdef tuple vgpu_type_get_device_id(unsigned int vgpu_type_id) +cpdef unsigned long long vgpu_type_get_framebuffer_size(unsigned int vgpu_type_id) except? 0 +cpdef unsigned int vgpu_type_get_num_display_heads(unsigned int vgpu_type_id) except? 0 +cpdef tuple vgpu_type_get_resolution(unsigned int vgpu_type_id, unsigned int display_ind_ex) +cpdef vgpu_type_get_license(unsigned int vgpu_type_id, intptr_t vgpu_type_license_string, unsigned int size) +cpdef unsigned int vgpu_type_get_frame_rate_limit(unsigned int vgpu_type_id) except? 0 +cpdef unsigned int vgpu_type_get_max_instances(intptr_t device, unsigned int vgpu_type_id) except? 0 +cpdef unsigned int vgpu_type_get_max_instances_per_vm(unsigned int vgpu_type_id) except? 0 +cpdef object vgpu_type_get_bar1_info(unsigned int vgpu_type_id) +cpdef str vgpu_instance_get_uuid(unsigned int vgpu_instance) +cpdef str vgpu_instance_get_vm_driver_version(unsigned int vgpu_instance) +cpdef unsigned long long vgpu_instance_get_fb_usage(unsigned int vgpu_instance) except? 0 +cpdef unsigned int vgpu_instance_get_license_status(unsigned int vgpu_instance) except? 0 +cpdef unsigned int vgpu_instance_get_type(unsigned int vgpu_instance) except? 0 +cpdef unsigned int vgpu_instance_get_frame_rate_limit(unsigned int vgpu_instance) except? 0 +cpdef int vgpu_instance_get_ecc_mode(unsigned int vgpu_instance) except? -1 +cpdef unsigned int vgpu_instance_get_encoder_capacity(unsigned int vgpu_instance) except? 0 +cpdef vgpu_instance_set_encoder_capacity(unsigned int vgpu_instance, unsigned int encoder_capacity) +cpdef tuple vgpu_instance_get_encoder_stats(unsigned int vgpu_instance) +cpdef object vgpu_instance_get_encoder_sessions(unsigned int vgpu_instance) +cpdef object vgpu_instance_get_fbc_stats(unsigned int vgpu_instance) +cpdef object vgpu_instance_get_fbc_sessions(unsigned int vgpu_instance) +cpdef unsigned int vgpu_instance_get_gpu_instance_id(unsigned int vgpu_instance) except? 0 +cpdef str vgpu_instance_get_gpu_pci_id(unsigned int vgpu_instance) +cpdef unsigned int vgpu_type_get_capabilities(unsigned int vgpu_type_id, int capability) except? 0 +cpdef str vgpu_instance_get_mdev_uuid(unsigned int vgpu_instance) +cpdef object vgpu_type_get_max_instances_per_gpu_instance() +cpdef gpu_instance_set_vgpu_scheduler_state(intptr_t gpu_instance, intptr_t p_scheduler) +cpdef object gpu_instance_get_vgpu_scheduler_state(intptr_t gpu_instance) +cpdef object gpu_instance_get_vgpu_scheduler_log(intptr_t gpu_instance) +cpdef object gpu_instance_get_vgpu_heterogeneous_mode(intptr_t gpu_instance) +cpdef gpu_instance_set_vgpu_heterogeneous_mode(intptr_t gpu_instance, intptr_t p_heterogeneous_mode) +cpdef str device_get_pgpu_metadata_string(intptr_t device) +cpdef object device_get_vgpu_scheduler_log(intptr_t device) +cpdef object device_get_vgpu_scheduler_state(intptr_t device) +cpdef object device_get_vgpu_scheduler_capabilities(intptr_t device) +cpdef device_set_vgpu_scheduler_state(intptr_t device, intptr_t p_scheduler_state) +cpdef set_vgpu_version(intptr_t vgpu_version) +cpdef tuple device_get_vgpu_utilization(intptr_t device, unsigned long long last_seen_time_stamp) +cpdef tuple device_get_vgpu_process_utilization(intptr_t device, unsigned long long last_seen_time_stamp) +cpdef int vgpu_instance_get_accounting_mode(unsigned int vgpu_instance) except? -1 +cpdef object vgpu_instance_get_accounting_pids(unsigned int vgpu_instance) +cpdef object vgpu_instance_get_accounting_stats(unsigned int vgpu_instance, unsigned int pid) +cpdef vgpu_instance_clear_accounting_pids(unsigned int vgpu_instance) +cpdef object vgpu_instance_get_license_info_v2(unsigned int vgpu_instance) +cpdef unsigned int get_excluded_device_count() except? 0 +cpdef object get_excluded_device_info_by_ind_ex(unsigned int ind_ex) +cpdef int device_set_mig_mode(intptr_t device, unsigned int mode) except? -1 +cpdef tuple device_get_mig_mode(intptr_t device) +cpdef object device_get_gpu_instance_profile_info_v(intptr_t device, unsigned int profile) +cpdef object device_get_gpu_instance_possible_placements_v2(intptr_t device, unsigned int profile_id) +cpdef unsigned int device_get_gpu_instance_remaining_capacity(intptr_t device, unsigned int profile_id) except? 0 +cpdef intptr_t device_create_gpu_instance(intptr_t device, unsigned int profile_id) except? 0 +cpdef intptr_t device_create_gpu_instance_with_placement(intptr_t device, unsigned int profile_id, intptr_t placement) except? 0 +cpdef gpu_instance_destroy(intptr_t gpu_instance) +cpdef intptr_t device_get_gpu_instance_by_id(intptr_t device, unsigned int id) except? 0 +cpdef object gpu_instance_get_info(intptr_t gpu_instance) +cpdef object gpu_instance_get_compute_instance_profile_info_v(intptr_t gpu_instance, unsigned int profile, unsigned int eng_profile) +cpdef unsigned int gpu_instance_get_compute_instance_remaining_capacity(intptr_t gpu_instance, unsigned int profile_id) except? 0 +cpdef object gpu_instance_get_compute_instance_possible_placements(intptr_t gpu_instance, unsigned int profile_id) +cpdef intptr_t gpu_instance_create_compute_instance(intptr_t gpu_instance, unsigned int profile_id) except? 0 +cpdef intptr_t gpu_instance_create_compute_instance_with_placement(intptr_t gpu_instance, unsigned int profile_id, intptr_t placement) except? 0 +cpdef compute_instance_destroy(intptr_t compute_instance) +cpdef intptr_t gpu_instance_get_compute_instance_by_id(intptr_t gpu_instance, unsigned int id) except? 0 +cpdef object compute_instance_get_info_v2(intptr_t compute_instance) +cpdef unsigned int device_is_mig_device_handle(intptr_t device) except? 0 +cpdef unsigned int device_get_gpu_instance_id(intptr_t device) except? 0 +cpdef unsigned int device_get_compute_instance_id(intptr_t device) except? 0 +cpdef unsigned int device_get_max_mig_device_count(intptr_t device) except? 0 +cpdef intptr_t device_get_mig_device_handle_by_ind_ex(intptr_t device, unsigned int ind_ex) except? 0 +cpdef intptr_t device_get_device_handle_from_mig_device_handle(intptr_t mig_device) except? 0 +cpdef gpm_sample_get(intptr_t device, intptr_t gpm_sample) +cpdef gpm_mig_sample_get(intptr_t device, unsigned int gpu_instance_id, intptr_t gpm_sample) +cpdef object gpm_query_device_support(intptr_t device) +cpdef unsigned int gpm_query_if_streaming_enabled(intptr_t device) except? 0 +cpdef gpm_set_streaming_enabled(intptr_t device, unsigned int state) +cpdef object device_get_capabilities(intptr_t device) +cpdef device_workload_power_profile_clear_requested_profiles(intptr_t device, intptr_t requested_profiles) +cpdef device_power_smoothing_activate_preset_profile(intptr_t device, intptr_t profile) +cpdef device_power_smoothing_update_preset_profile_param(intptr_t device, intptr_t profile) +cpdef device_power_smoothing_set_state(intptr_t device, intptr_t state) +cpdef object device_get_addressing_mode(intptr_t device) +cpdef object device_get_repair_status(intptr_t device) +cpdef object device_get_power_mizer_mode_v1(intptr_t device) +cpdef device_set_power_mizer_mode_v1(intptr_t device, intptr_t power_mizer_mode) +cpdef object device_get_pdi(intptr_t device) +cpdef object device_get_nv_link_info(intptr_t device) +cpdef device_read_write_prm_v1(intptr_t device, intptr_t buffer) +cpdef object device_get_gpu_instance_profile_info_by_id_v(intptr_t device, unsigned int profile_id) diff --git a/cuda_bindings/cuda/bindings/nvml.pyx b/cuda_bindings/cuda/bindings/nvml.pyx new file mode 100644 index 0000000000..ab4bb1376c --- /dev/null +++ b/cuda_bindings/cuda/bindings/nvml.pyx @@ -0,0 +1,24200 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE +# +# This code was automatically generated across versions from 12.9.1 to 13.0.1. Do not modify it directly. + +cimport cython # NOQA +from cython cimport view +cimport cpython + +from ._internal.utils cimport (get_buffer_pointer, get_nested_resource_ptr, + nested_resource) + +from enum import IntEnum as _IntEnum + + +from libc.stdlib cimport calloc, free, malloc +from cython cimport view +cimport cpython.buffer +cimport cpython.memoryview +from libc.string cimport memcmp, memcpy +import numpy as _numpy + + +cdef __from_data(data, dtype_name, expected_dtype, lowpp_type_from_ptr): + # _numpy.recarray is a subclass of _numpy.ndarray, so implicitly handled here. + 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) + + +############################################################################### +# Enum +############################################################################### + +class BridgeChipType(_IntEnum): + """See `nvmlBridgeChipType_t`.""" + BRIDGE_CHIP_PLX = NVML_BRIDGE_CHIP_PLX + BRIDGE_CHIP_BRO4 = NVML_BRIDGE_CHIP_BRO4 + +class NvLinkUtilizationCountUnits(_IntEnum): + """See `nvmlNvLinkUtilizationCountUnits_t`.""" + NVLINK_COUNTER_UNIT_CYCLES = NVML_NVLINK_COUNTER_UNIT_CYCLES + NVLINK_COUNTER_UNIT_PACKETS = NVML_NVLINK_COUNTER_UNIT_PACKETS + NVLINK_COUNTER_UNIT_BYTES = NVML_NVLINK_COUNTER_UNIT_BYTES + NVLINK_COUNTER_UNIT_RESERVED = NVML_NVLINK_COUNTER_UNIT_RESERVED + NVLINK_COUNTER_UNIT_COUNT = NVML_NVLINK_COUNTER_UNIT_COUNT + +class NvLinkUtilizationCountPktTypes(_IntEnum): + """See `nvmlNvLinkUtilizationCountPktTypes_t`.""" + NVLINK_COUNTER_PKTFILTER_NOP = NVML_NVLINK_COUNTER_PKTFILTER_NOP + NVLINK_COUNTER_PKTFILTER_READ = NVML_NVLINK_COUNTER_PKTFILTER_READ + NVLINK_COUNTER_PKTFILTER_WRITE = NVML_NVLINK_COUNTER_PKTFILTER_WRITE + NVLINK_COUNTER_PKTFILTER_RATOM = NVML_NVLINK_COUNTER_PKTFILTER_RATOM + NVLINK_COUNTER_PKTFILTER_NRATOM = NVML_NVLINK_COUNTER_PKTFILTER_NRATOM + NVLINK_COUNTER_PKTFILTER_FLUSH = NVML_NVLINK_COUNTER_PKTFILTER_FLUSH + NVLINK_COUNTER_PKTFILTER_RESPDATA = NVML_NVLINK_COUNTER_PKTFILTER_RESPDATA + NVLINK_COUNTER_PKTFILTER_RESPNODATA = NVML_NVLINK_COUNTER_PKTFILTER_RESPNODATA + NVLINK_COUNTER_PKTFILTER_ALL = NVML_NVLINK_COUNTER_PKTFILTER_ALL + +class NvLinkCapability(_IntEnum): + """See `nvmlNvLinkCapability_t`.""" + NVLINK_CAP_P2P_SUPPORTED = NVML_NVLINK_CAP_P2P_SUPPORTED + NVLINK_CAP_SYSMEM_ACCESS = NVML_NVLINK_CAP_SYSMEM_ACCESS + NVLINK_CAP_P2P_ATOMICS = NVML_NVLINK_CAP_P2P_ATOMICS + NVLINK_CAP_SYSMEM_ATOMICS = NVML_NVLINK_CAP_SYSMEM_ATOMICS + NVLINK_CAP_SLI_BRIDGE = NVML_NVLINK_CAP_SLI_BRIDGE + NVLINK_CAP_VALID = NVML_NVLINK_CAP_VALID + NVLINK_CAP_COUNT = NVML_NVLINK_CAP_COUNT + +class NvLinkErrorCounter(_IntEnum): + """See `nvmlNvLinkErrorCounter_t`.""" + NVLINK_ERROR_DL_REPLAY = NVML_NVLINK_ERROR_DL_REPLAY + NVLINK_ERROR_DL_RECOVERY = NVML_NVLINK_ERROR_DL_RECOVERY + NVLINK_ERROR_DL_CRC_FLIT = NVML_NVLINK_ERROR_DL_CRC_FLIT + NVLINK_ERROR_DL_CRC_DATA = NVML_NVLINK_ERROR_DL_CRC_DATA + NVLINK_ERROR_DL_ECC_DATA = NVML_NVLINK_ERROR_DL_ECC_DATA + NVLINK_ERROR_COUNT = NVML_NVLINK_ERROR_COUNT + +class IntNvLinkDeviceType(_IntEnum): + """See `nvmlIntNvLinkDeviceType_t`.""" + NVLINK_DEVICE_TYPE_GPU = NVML_NVLINK_DEVICE_TYPE_GPU + NVLINK_DEVICE_TYPE_IBMNPU = NVML_NVLINK_DEVICE_TYPE_IBMNPU + NVLINK_DEVICE_TYPE_SWITCH = NVML_NVLINK_DEVICE_TYPE_SWITCH + NVLINK_DEVICE_TYPE_UNKNOWN = NVML_NVLINK_DEVICE_TYPE_UNKNOWN + +class GpuTopologyLevel(_IntEnum): + """See `nvmlGpuTopologyLevel_t`.""" + TOPOLOGY_INTERNAL = NVML_TOPOLOGY_INTERNAL + TOPOLOGY_SINGLE = NVML_TOPOLOGY_SINGLE + TOPOLOGY_MULTIPLE = NVML_TOPOLOGY_MULTIPLE + TOPOLOGY_HOSTBRIDGE = NVML_TOPOLOGY_HOSTBRIDGE + TOPOLOGY_NODE = NVML_TOPOLOGY_NODE + TOPOLOGY_SYSTEM = NVML_TOPOLOGY_SYSTEM + +class GpuP2PStatus(_IntEnum): + """See `nvmlGpuP2PStatus_t`.""" + P2P_STATUS_OK = NVML_P2P_STATUS_OK + P2P_STATUS_CHIPSET_NOT_SUPPORED = NVML_P2P_STATUS_CHIPSET_NOT_SUPPORED + P2P_STATUS_CHIPSET_NOT_SUPPORTED = NVML_P2P_STATUS_CHIPSET_NOT_SUPPORTED + P2P_STATUS_GPU_NOT_SUPPORTED = NVML_P2P_STATUS_GPU_NOT_SUPPORTED + P2P_STATUS_IOH_TOPOLOGY_NOT_SUPPORTED = NVML_P2P_STATUS_IOH_TOPOLOGY_NOT_SUPPORTED + P2P_STATUS_DISABLED_BY_REGKEY = NVML_P2P_STATUS_DISABLED_BY_REGKEY + P2P_STATUS_NOT_SUPPORTED = NVML_P2P_STATUS_NOT_SUPPORTED + P2P_STATUS_UNKNOWN = NVML_P2P_STATUS_UNKNOWN + +class GpuP2PCapsIndex(_IntEnum): + """See `nvmlGpuP2PCapsIndex_t`.""" + P2P_CAPS_INDEX_READ = NVML_P2P_CAPS_INDEX_READ + P2P_CAPS_INDEX_WRITE = NVML_P2P_CAPS_INDEX_WRITE + P2P_CAPS_INDEX_NVLINK = NVML_P2P_CAPS_INDEX_NVLINK + P2P_CAPS_INDEX_ATOMICS = NVML_P2P_CAPS_INDEX_ATOMICS + P2P_CAPS_INDEX_PCI = NVML_P2P_CAPS_INDEX_PCI + P2P_CAPS_INDEX_PROP = NVML_P2P_CAPS_INDEX_PROP + P2P_CAPS_INDEX_UNKNOWN = NVML_P2P_CAPS_INDEX_UNKNOWN + +class SamplingType(_IntEnum): + """See `nvmlSamplingType_t`.""" + TOTAL_POWER_SAMPLES = NVML_TOTAL_POWER_SAMPLES + GPU_UTILIZATION_SAMPLES = NVML_GPU_UTILIZATION_SAMPLES + MEMORY_UTILIZATION_SAMPLES = NVML_MEMORY_UTILIZATION_SAMPLES + ENC_UTILIZATION_SAMPLES = NVML_ENC_UTILIZATION_SAMPLES + DEC_UTILIZATION_SAMPLES = NVML_DEC_UTILIZATION_SAMPLES + PROCESSOR_CLK_SAMPLES = NVML_PROCESSOR_CLK_SAMPLES + MEMORY_CLK_SAMPLES = NVML_MEMORY_CLK_SAMPLES + MODULE_POWER_SAMPLES = NVML_MODULE_POWER_SAMPLES + JPG_UTILIZATION_SAMPLES = NVML_JPG_UTILIZATION_SAMPLES + OFA_UTILIZATION_SAMPLES = NVML_OFA_UTILIZATION_SAMPLES + SAMPLINGTYPE_COUNT = NVML_SAMPLINGTYPE_COUNT + +class PcieUtilCounter(_IntEnum): + """See `nvmlPcieUtilCounter_t`.""" + PCIE_UTIL_TX_BYTES = NVML_PCIE_UTIL_TX_BYTES + PCIE_UTIL_RX_BYTES = NVML_PCIE_UTIL_RX_BYTES + PCIE_UTIL_COUNT = NVML_PCIE_UTIL_COUNT + +class ValueType(_IntEnum): + """See `nvmlValueType_t`.""" + DOUBLE = NVML_VALUE_TYPE_DOUBLE + UNSIGNED_INT = NVML_VALUE_TYPE_UNSIGNED_INT + UNSIGNED_LONG = NVML_VALUE_TYPE_UNSIGNED_LONG + UNSIGNED_LONG_LONG = NVML_VALUE_TYPE_UNSIGNED_LONG_LONG + SIGNED_LONG_LONG = NVML_VALUE_TYPE_SIGNED_LONG_LONG + SIGNED_INT = NVML_VALUE_TYPE_SIGNED_INT + UNSIGNED_SHORT = NVML_VALUE_TYPE_UNSIGNED_SHORT + COUNT = NVML_VALUE_TYPE_COUNT + +class PerfPolicyType(_IntEnum): + """See `nvmlPerfPolicyType_t`.""" + PERF_POLICY_POWER = NVML_PERF_POLICY_POWER + PERF_POLICY_THERMAL = NVML_PERF_POLICY_THERMAL + PERF_POLICY_SYNC_BOOST = NVML_PERF_POLICY_SYNC_BOOST + PERF_POLICY_BOARD_LIMIT = NVML_PERF_POLICY_BOARD_LIMIT + PERF_POLICY_LOW_UTILIZATION = NVML_PERF_POLICY_LOW_UTILIZATION + PERF_POLICY_RELIABILITY = NVML_PERF_POLICY_RELIABILITY + PERF_POLICY_TOTAL_APP_CLOCKS = NVML_PERF_POLICY_TOTAL_APP_CLOCKS + PERF_POLICY_TOTAL_BASE_CLOCKS = NVML_PERF_POLICY_TOTAL_BASE_CLOCKS + PERF_POLICY_COUNT = NVML_PERF_POLICY_COUNT + +class ThermalTarget(_IntEnum): + """See `nvmlThermalTarget_t`.""" + NONE = NVML_THERMAL_TARGET_NONE + GPU = NVML_THERMAL_TARGET_GPU + MEMORY = NVML_THERMAL_TARGET_MEMORY + POWER_SUPPLY = NVML_THERMAL_TARGET_POWER_SUPPLY + BOARD = NVML_THERMAL_TARGET_BOARD + VCD_BOARD = NVML_THERMAL_TARGET_VCD_BOARD + VCD_INLET = NVML_THERMAL_TARGET_VCD_INLET + VCD_OUTLET = NVML_THERMAL_TARGET_VCD_OUTLET + ALL = NVML_THERMAL_TARGET_ALL + UNKNOWN = NVML_THERMAL_TARGET_UNKNOWN + +class ThermalController(_IntEnum): + """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(_IntEnum): + """See `nvmlCoolerControl_t`.""" + THERMAL_COOLER_SIGNAL_NONE = NVML_THERMAL_COOLER_SIGNAL_NONE + THERMAL_COOLER_SIGNAL_TOGGLE = NVML_THERMAL_COOLER_SIGNAL_TOGGLE + THERMAL_COOLER_SIGNAL_VARIABLE = NVML_THERMAL_COOLER_SIGNAL_VARIABLE + THERMAL_COOLER_SIGNAL_COUNT = NVML_THERMAL_COOLER_SIGNAL_COUNT + +class CoolerTarget(_IntEnum): + """See `nvmlCoolerTarget_t`.""" + THERMAL_NONE = NVML_THERMAL_COOLER_TARGET_NONE + THERMAL_GPU = NVML_THERMAL_COOLER_TARGET_GPU + THERMAL_MEMORY = NVML_THERMAL_COOLER_TARGET_MEMORY + THERMAL_POWER_SUPPLY = NVML_THERMAL_COOLER_TARGET_POWER_SUPPLY + THERMAL_GPU_RELATED = NVML_THERMAL_COOLER_TARGET_GPU_RELATED + +class UUIDType(_IntEnum): + """See `nvmlUUIDType_t`.""" + NONE = NVML_UUID_TYPE_NONE + ASCII = NVML_UUID_TYPE_ASCII + BINARY = NVML_UUID_TYPE_BINARY + +class EnableState(_IntEnum): + """See `nvmlEnableState_t`.""" + FEATURE_DISABLED = NVML_FEATURE_DISABLED + FEATURE_ENABLED = NVML_FEATURE_ENABLED + +class BrandType(_IntEnum): + """See `nvmlBrandType_t`.""" + BRAND_UNKNOWN = NVML_BRAND_UNKNOWN + BRAND_QUADRO = NVML_BRAND_QUADRO + BRAND_TESLA = NVML_BRAND_TESLA + BRAND_NVS = NVML_BRAND_NVS + BRAND_GRID = NVML_BRAND_GRID + BRAND_GEFORCE = NVML_BRAND_GEFORCE + BRAND_TITAN = NVML_BRAND_TITAN + BRAND_NVIDIA_VAPPS = NVML_BRAND_NVIDIA_VAPPS + BRAND_NVIDIA_VPC = NVML_BRAND_NVIDIA_VPC + BRAND_NVIDIA_VCS = NVML_BRAND_NVIDIA_VCS + BRAND_NVIDIA_VWS = NVML_BRAND_NVIDIA_VWS + BRAND_NVIDIA_CLOUD_GAMING = NVML_BRAND_NVIDIA_CLOUD_GAMING + BRAND_NVIDIA_VGAMING = NVML_BRAND_NVIDIA_VGAMING + BRAND_QUADRO_RTX = NVML_BRAND_QUADRO_RTX + BRAND_NVIDIA_RTX = NVML_BRAND_NVIDIA_RTX + BRAND_NVIDIA = NVML_BRAND_NVIDIA + BRAND_GEFORCE_RTX = NVML_BRAND_GEFORCE_RTX + BRAND_TITAN_RTX = NVML_BRAND_TITAN_RTX + BRAND_COUNT = NVML_BRAND_COUNT + +class TemperatureThresholds(_IntEnum): + """See `nvmlTemperatureThresholds_t`.""" + TEMPERATURE_THRESHOLD_SHUTDOWN = NVML_TEMPERATURE_THRESHOLD_SHUTDOWN + TEMPERATURE_THRESHOLD_SLOWDOWN = NVML_TEMPERATURE_THRESHOLD_SLOWDOWN + TEMPERATURE_THRESHOLD_MEM_MAX = NVML_TEMPERATURE_THRESHOLD_MEM_MAX + TEMPERATURE_THRESHOLD_GPU_MAX = NVML_TEMPERATURE_THRESHOLD_GPU_MAX + TEMPERATURE_THRESHOLD_ACOUSTIC_MIN = NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_MIN + TEMPERATURE_THRESHOLD_ACOUSTIC_CURR = NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_CURR + TEMPERATURE_THRESHOLD_ACOUSTIC_MAX = NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_MAX + TEMPERATURE_THRESHOLD_GPS_CURR = NVML_TEMPERATURE_THRESHOLD_GPS_CURR + TEMPERATURE_THRESHOLD_COUNT = NVML_TEMPERATURE_THRESHOLD_COUNT + +class TemperatureSensors(_IntEnum): + """See `nvmlTemperatureSensors_t`.""" + TEMPERATURE_GPU = NVML_TEMPERATURE_GPU + TEMPERATURE_COUNT = NVML_TEMPERATURE_COUNT + +class ComputeMode(_IntEnum): + """See `nvmlComputeMode_t`.""" + COMPUTEMODE_DEFAULT = NVML_COMPUTEMODE_DEFAULT + COMPUTEMODE_EXCLUSIVE_THREAD = NVML_COMPUTEMODE_EXCLUSIVE_THREAD + COMPUTEMODE_PROHIBITED = NVML_COMPUTEMODE_PROHIBITED + COMPUTEMODE_EXCLUSIVE_PROCESS = NVML_COMPUTEMODE_EXCLUSIVE_PROCESS + COMPUTEMODE_COUNT = NVML_COMPUTEMODE_COUNT + +class MemoryErrorType(_IntEnum): + """See `nvmlMemoryErrorType_t`.""" + CORRECTED = NVML_MEMORY_ERROR_TYPE_CORRECTED + UNCORRECTED = NVML_MEMORY_ERROR_TYPE_UNCORRECTED + COUNT = NVML_MEMORY_ERROR_TYPE_COUNT + +class NvlinkVersion(_IntEnum): + """See `nvmlNvlinkVersion_t`.""" + VERSION_INVALID = NVML_NVLINK_VERSION_INVALID + VERSION_1_0 = NVML_NVLINK_VERSION_1_0 + VERSION_2_0 = NVML_NVLINK_VERSION_2_0 + VERSION_2_2 = NVML_NVLINK_VERSION_2_2 + VERSION_3_0 = NVML_NVLINK_VERSION_3_0 + VERSION_3_1 = NVML_NVLINK_VERSION_3_1 + VERSION_4_0 = NVML_NVLINK_VERSION_4_0 + VERSION_5_0 = NVML_NVLINK_VERSION_5_0 + +class EccCounterType(_IntEnum): + """See `nvmlEccCounterType_t`.""" + VOLATILE_ECC = NVML_VOLATILE_ECC + AGGREGATE_ECC = NVML_AGGREGATE_ECC + COUNT = NVML_ECC_COUNTER_TYPE_COUNT + +class ClockType(_IntEnum): + """See `nvmlClockType_t`.""" + CLOCK_GRAPHICS = NVML_CLOCK_GRAPHICS + CLOCK_SM = NVML_CLOCK_SM + CLOCK_MEM = NVML_CLOCK_MEM + CLOCK_VIDEO = NVML_CLOCK_VIDEO + CLOCK_COUNT = NVML_CLOCK_COUNT + +class ClockId(_IntEnum): + """See `nvmlClockId_t`.""" + CURRENT = NVML_CLOCK_ID_CURRENT + APP_CLOCK_TARGET = NVML_CLOCK_ID_APP_CLOCK_TARGET + APP_CLOCK_DEFAULT = NVML_CLOCK_ID_APP_CLOCK_DEFAULT + CUSTOMER_BOOST_MAX = NVML_CLOCK_ID_CUSTOMER_BOOST_MAX + COUNT = NVML_CLOCK_ID_COUNT + +class DriverModel(_IntEnum): + """See `nvmlDriverModel_t`.""" + DRIVER_WDDM = NVML_DRIVER_WDDM + DRIVER_WDM = NVML_DRIVER_WDM + DRIVER_MCDM = NVML_DRIVER_MCDM + +class Pstates(_IntEnum): + """See `nvmlPstates_t`.""" + PSTATE_0 = NVML_PSTATE_0 + PSTATE_1 = NVML_PSTATE_1 + PSTATE_2 = NVML_PSTATE_2 + PSTATE_3 = NVML_PSTATE_3 + PSTATE_4 = NVML_PSTATE_4 + PSTATE_5 = NVML_PSTATE_5 + PSTATE_6 = NVML_PSTATE_6 + PSTATE_7 = NVML_PSTATE_7 + PSTATE_8 = NVML_PSTATE_8 + PSTATE_9 = NVML_PSTATE_9 + PSTATE_10 = NVML_PSTATE_10 + PSTATE_11 = NVML_PSTATE_11 + PSTATE_12 = NVML_PSTATE_12 + PSTATE_13 = NVML_PSTATE_13 + PSTATE_14 = NVML_PSTATE_14 + PSTATE_15 = NVML_PSTATE_15 + PSTATE_UNKNOWN = NVML_PSTATE_UNKNOWN + +class GpuOperationMode(_IntEnum): + """See `nvmlGpuOperationMode_t`.""" + GOM_ALL_ON = NVML_GOM_ALL_ON + GOM_COMPUTE = NVML_GOM_COMPUTE + GOM_LOW_DP = NVML_GOM_LOW_DP + +class InforomObject(_IntEnum): + """See `nvmlInforomObject_t`.""" + INFOROM_OEM = NVML_INFOROM_OEM + INFOROM_ECC = NVML_INFOROM_ECC + INFOROM_POWER = NVML_INFOROM_POWER + INFOROM_DEN = NVML_INFOROM_DEN + INFOROM_COUNT = NVML_INFOROM_COUNT + +class Return(_IntEnum): + """See `nvmlReturn_t`.""" + SUCCESS = NVML_SUCCESS + ERROR_UNINITIALIZED = NVML_ERROR_UNINITIALIZED + ERROR_INVALID_ARGUMENT = NVML_ERROR_INVALID_ARGUMENT + ERROR_NOT_SUPPORTED = NVML_ERROR_NOT_SUPPORTED + ERROR_NO_PERMISSION = NVML_ERROR_NO_PERMISSION + ERROR_ALREADY_INITIALIZED = NVML_ERROR_ALREADY_INITIALIZED + ERROR_NOT_FOUND = NVML_ERROR_NOT_FOUND + ERROR_INSUFFICIENT_SIZE = NVML_ERROR_INSUFFICIENT_SIZE + ERROR_INSUFFICIENT_POWER = NVML_ERROR_INSUFFICIENT_POWER + ERROR_DRIVER_NOT_LOADED = NVML_ERROR_DRIVER_NOT_LOADED + ERROR_TIMEOUT = NVML_ERROR_TIMEOUT + ERROR_IRQ_ISSUE = NVML_ERROR_IRQ_ISSUE + ERROR_LIBRARY_NOT_FOUND = NVML_ERROR_LIBRARY_NOT_FOUND + ERROR_FUNCTION_NOT_FOUND = NVML_ERROR_FUNCTION_NOT_FOUND + ERROR_CORRUPTED_INFOROM = NVML_ERROR_CORRUPTED_INFOROM + ERROR_GPU_IS_LOST = NVML_ERROR_GPU_IS_LOST + ERROR_RESET_REQUIRED = NVML_ERROR_RESET_REQUIRED + ERROR_OPERATING_SYSTEM = NVML_ERROR_OPERATING_SYSTEM + ERROR_LIB_RM_VERSION_MISMATCH = NVML_ERROR_LIB_RM_VERSION_MISMATCH + ERROR_IN_USE = NVML_ERROR_IN_USE + ERROR_MEMORY = NVML_ERROR_MEMORY + ERROR_NO_DATA = NVML_ERROR_NO_DATA + ERROR_VGPU_ECC_NOT_SUPPORTED = NVML_ERROR_VGPU_ECC_NOT_SUPPORTED + ERROR_INSUFFICIENT_RESOURCES = NVML_ERROR_INSUFFICIENT_RESOURCES + ERROR_FREQ_NOT_SUPPORTED = NVML_ERROR_FREQ_NOT_SUPPORTED + ERROR_ARGUMENT_VERSION_MISMATCH = NVML_ERROR_ARGUMENT_VERSION_MISMATCH + ERROR_DEPRECATED = NVML_ERROR_DEPRECATED + ERROR_NOT_READY = NVML_ERROR_NOT_READY + ERROR_GPU_NOT_FOUND = NVML_ERROR_GPU_NOT_FOUND + ERROR_INVALID_STATE = NVML_ERROR_INVALID_STATE + ERROR_RESET_TYPE_NOT_SUPPORTED = NVML_ERROR_RESET_TYPE_NOT_SUPPORTED + ERROR_UNKNOWN = NVML_ERROR_UNKNOWN + +class MemoryLocation(_IntEnum): + """See `nvmlMemoryLocation_t`.""" + L1_CACHE = NVML_MEMORY_LOCATION_L1_CACHE + L2_CACHE = NVML_MEMORY_LOCATION_L2_CACHE + DRAM = NVML_MEMORY_LOCATION_DRAM + DEVICE_MEMORY = NVML_MEMORY_LOCATION_DEVICE_MEMORY + REGISTER_FILE = NVML_MEMORY_LOCATION_REGISTER_FILE + TEXTURE_MEMORY = NVML_MEMORY_LOCATION_TEXTURE_MEMORY + TEXTURE_SHM = NVML_MEMORY_LOCATION_TEXTURE_SHM + CBU = NVML_MEMORY_LOCATION_CBU + SRAM = NVML_MEMORY_LOCATION_SRAM + COUNT = NVML_MEMORY_LOCATION_COUNT + +class PageRetirementCause(_IntEnum): + """See `nvmlPageRetirementCause_t`.""" + MULTIPLE_SINGLE_BIT_ECC_ERRORS = NVML_PAGE_RETIREMENT_CAUSE_MULTIPLE_SINGLE_BIT_ECC_ERRORS + DOUBLE_BIT_ECC_ERROR = NVML_PAGE_RETIREMENT_CAUSE_DOUBLE_BIT_ECC_ERROR + COUNT = NVML_PAGE_RETIREMENT_CAUSE_COUNT + +class RestrictedAPI(_IntEnum): + """See `nvmlRestrictedAPI_t`.""" + SET_APPLICATION_CLOCKS = NVML_RESTRICTED_API_SET_APPLICATION_CLOCKS + SET_AUTO_BOOSTED_CLOCKS = NVML_RESTRICTED_API_SET_AUTO_BOOSTED_CLOCKS + COUNT = NVML_RESTRICTED_API_COUNT + +class GpuUtilizationDomainId(_IntEnum): + """See `nvmlGpuUtilizationDomainId_t`.""" + GPU_UTILIZATION_DOMAIN_GPU = NVML_GPU_UTILIZATION_DOMAIN_GPU + GPU_UTILIZATION_DOMAIN_FB = NVML_GPU_UTILIZATION_DOMAIN_FB + GPU_UTILIZATION_DOMAIN_VID = NVML_GPU_UTILIZATION_DOMAIN_VID + GPU_UTILIZATION_DOMAIN_BUS = NVML_GPU_UTILIZATION_DOMAIN_BUS + +class GpuVirtualizationMode(_IntEnum): + """See `nvmlGpuVirtualizationMode_t`.""" + NONE = NVML_GPU_VIRTUALIZATION_MODE_NONE + PASSTHROUGH = NVML_GPU_VIRTUALIZATION_MODE_PASSTHROUGH + VGPU = NVML_GPU_VIRTUALIZATION_MODE_VGPU + HOST_VGPU = NVML_GPU_VIRTUALIZATION_MODE_HOST_VGPU + HOST_VSGA = NVML_GPU_VIRTUALIZATION_MODE_HOST_VSGA + +class HostVgpuMode(_IntEnum): + """See `nvmlHostVgpuMode_t`.""" + NON_SRIOV = NVML_HOST_VGPU_MODE_NON_SRIOV + SRIOV = NVML_HOST_VGPU_MODE_SRIOV + +class VgpuVmIdType(_IntEnum): + """See `nvmlVgpuVmIdType_t`.""" + VGPU_VM_ID_DOMAIN_ID = NVML_VGPU_VM_ID_DOMAIN_ID + VGPU_VM_ID_UUID = NVML_VGPU_VM_ID_UUID + +class VgpuGuestInfoState(_IntEnum): + """See `nvmlVgpuGuestInfoState_t`.""" + VGPU_INSTANCE_GUEST_INFO_STATE_UNINITIALIZED = NVML_VGPU_INSTANCE_GUEST_INFO_STATE_UNINITIALIZED + VGPU_INSTANCE_GUEST_INFO_STATE_INITIALIZED = NVML_VGPU_INSTANCE_GUEST_INFO_STATE_INITIALIZED + +class GridLicenseFeatureCode(_IntEnum): + """See `nvmlGridLicenseFeatureCode_t`.""" + UNKNOWN = NVML_GRID_LICENSE_FEATURE_CODE_UNKNOWN + VGPU = NVML_GRID_LICENSE_FEATURE_CODE_VGPU + NVIDIA_RTX = NVML_GRID_LICENSE_FEATURE_CODE_NVIDIA_RTX + VWORKSTATION = NVML_GRID_LICENSE_FEATURE_CODE_VWORKSTATION + GAMING = NVML_GRID_LICENSE_FEATURE_CODE_GAMING + COMPUTE = NVML_GRID_LICENSE_FEATURE_CODE_COMPUTE + +class VgpuCapability(_IntEnum): + """See `nvmlVgpuCapability_t`.""" + VGPU_CAP_NVLINK_P2P = NVML_VGPU_CAP_NVLINK_P2P + VGPU_CAP_GPUDIRECT = NVML_VGPU_CAP_GPUDIRECT + VGPU_CAP_MULTI_VGPU_EXCLUSIVE = NVML_VGPU_CAP_MULTI_VGPU_EXCLUSIVE + VGPU_CAP_EXCLUSIVE_TYPE = NVML_VGPU_CAP_EXCLUSIVE_TYPE + VGPU_CAP_EXCLUSIVE_SIZE = NVML_VGPU_CAP_EXCLUSIVE_SIZE + VGPU_CAP_COUNT = NVML_VGPU_CAP_COUNT + +class VgpuDriverCapability(_IntEnum): + """See `nvmlVgpuDriverCapability_t`.""" + VGPU_DRIVER_CAP_HETEROGENEOUS_MULTI_VGPU = NVML_VGPU_DRIVER_CAP_HETEROGENEOUS_MULTI_VGPU + VGPU_DRIVER_CAP_WARM_UPDATE = NVML_VGPU_DRIVER_CAP_WARM_UPDATE + VGPU_DRIVER_CAP_COUNT = NVML_VGPU_DRIVER_CAP_COUNT + +class DeviceVgpuCapability(_IntEnum): + """See `nvmlDeviceVgpuCapability_t`.""" + DEVICE_VGPU_CAP_FRACTIONAL_MULTI_VGPU = NVML_DEVICE_VGPU_CAP_FRACTIONAL_MULTI_VGPU + DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_PROFILES = NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_PROFILES + DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_SIZES = NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_SIZES + DEVICE_VGPU_CAP_READ_DEVICE_BUFFER_BW = NVML_DEVICE_VGPU_CAP_READ_DEVICE_BUFFER_BW + DEVICE_VGPU_CAP_WRITE_DEVICE_BUFFER_BW = NVML_DEVICE_VGPU_CAP_WRITE_DEVICE_BUFFER_BW + DEVICE_VGPU_CAP_DEVICE_STREAMING = NVML_DEVICE_VGPU_CAP_DEVICE_STREAMING + DEVICE_VGPU_CAP_MINI_QUARTER_GPU = NVML_DEVICE_VGPU_CAP_MINI_QUARTER_GPU + DEVICE_VGPU_CAP_COMPUTE_MEDIA_ENGINE_GPU = NVML_DEVICE_VGPU_CAP_COMPUTE_MEDIA_ENGINE_GPU + DEVICE_VGPU_CAP_WARM_UPDATE = NVML_DEVICE_VGPU_CAP_WARM_UPDATE + DEVICE_VGPU_CAP_HOMOGENEOUS_PLACEMENTS = NVML_DEVICE_VGPU_CAP_HOMOGENEOUS_PLACEMENTS + DEVICE_VGPU_CAP_MIG_TIMESLICING_SUPPORTED = NVML_DEVICE_VGPU_CAP_MIG_TIMESLICING_SUPPORTED + DEVICE_VGPU_CAP_MIG_TIMESLICING_ENABLED = NVML_DEVICE_VGPU_CAP_MIG_TIMESLICING_ENABLED + DEVICE_VGPU_CAP_COUNT = NVML_DEVICE_VGPU_CAP_COUNT + +class DeviceGpuRecoveryAction(_IntEnum): + """See `nvmlDeviceGpuRecoveryAction_t`.""" + GPU_RECOVERY_ACTION_NONE = NVML_GPU_RECOVERY_ACTION_NONE + GPU_RECOVERY_ACTION_GPU_RESET = NVML_GPU_RECOVERY_ACTION_GPU_RESET + GPU_RECOVERY_ACTION_NODE_REBOOT = NVML_GPU_RECOVERY_ACTION_NODE_REBOOT + GPU_RECOVERY_ACTION_DRAIN_P2P = NVML_GPU_RECOVERY_ACTION_DRAIN_P2P + GPU_RECOVERY_ACTION_DRAIN_AND_RESET = NVML_GPU_RECOVERY_ACTION_DRAIN_AND_RESET + +class FanState(_IntEnum): + """See `nvmlFanState_t`.""" + FAN_NORMAL = NVML_FAN_NORMAL + FAN_FAILED = NVML_FAN_FAILED + +class LedColor(_IntEnum): + """See `nvmlLedColor_t`.""" + GREEN = NVML_LED_COLOR_GREEN + AMBER = NVML_LED_COLOR_AMBER + +class EncoderType(_IntEnum): + """See `nvmlEncoderType_t`.""" + ENCODER_QUERY_H264 = NVML_ENCODER_QUERY_H264 + ENCODER_QUERY_HEVC = NVML_ENCODER_QUERY_HEVC + ENCODER_QUERY_AV1 = NVML_ENCODER_QUERY_AV1 + ENCODER_QUERY_UNKNOWN = NVML_ENCODER_QUERY_UNKNOWN + +class FBCSessionType(_IntEnum): + """See `nvmlFBCSessionType_t`.""" + UNKNOWN = NVML_FBC_SESSION_TYPE_UNKNOWN + TOSYS = NVML_FBC_SESSION_TYPE_TOSYS + CUDA = NVML_FBC_SESSION_TYPE_CUDA + VID = NVML_FBC_SESSION_TYPE_VID + HWENC = NVML_FBC_SESSION_TYPE_HWENC + +class DetachGpuState(_IntEnum): + """See `nvmlDetachGpuState_t`.""" + DETACH_GPU_KEEP = NVML_DETACH_GPU_KEEP + DETACH_GPU_REMOVE = NVML_DETACH_GPU_REMOVE + +class PcieLinkState(_IntEnum): + """See `nvmlPcieLinkState_t`.""" + PCIE_LINK_KEEP = NVML_PCIE_LINK_KEEP + PCIE_LINK_SHUT_DOWN = NVML_PCIE_LINK_SHUT_DOWN + +class ClockLimitId(_IntEnum): + """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(_IntEnum): + """See `nvmlVgpuVmCompatibility_t`.""" + NONE = NVML_VGPU_VM_COMPATIBILITY_NONE + COLD = NVML_VGPU_VM_COMPATIBILITY_COLD + HIBERNATE = NVML_VGPU_VM_COMPATIBILITY_HIBERNATE + SLEEP = NVML_VGPU_VM_COMPATIBILITY_SLEEP + LIVE = NVML_VGPU_VM_COMPATIBILITY_LIVE + +class VgpuPgpuCompatibilityLimitCode(_IntEnum): + """See `nvmlVgpuPgpuCompatibilityLimitCode_t`.""" + VGPU_COMPATIBILITY_LIMIT_NONE = NVML_VGPU_COMPATIBILITY_LIMIT_NONE + VGPU_COMPATIBILITY_LIMIT_HOST_DRIVER = NVML_VGPU_COMPATIBILITY_LIMIT_HOST_DRIVER + VGPU_COMPATIBILITY_LIMIT_GUEST_DRIVER = NVML_VGPU_COMPATIBILITY_LIMIT_GUEST_DRIVER + VGPU_COMPATIBILITY_LIMIT_GPU = NVML_VGPU_COMPATIBILITY_LIMIT_GPU + VGPU_COMPATIBILITY_LIMIT_OTHER = NVML_VGPU_COMPATIBILITY_LIMIT_OTHER + +class GpmMetricId(_IntEnum): + """See `nvmlGpmMetricId_t`.""" + GPM_METRIC_GRAPHICS_UTIL = NVML_GPM_METRIC_GRAPHICS_UTIL + GPM_METRIC_SM_UTIL = NVML_GPM_METRIC_SM_UTIL + GPM_METRIC_SM_OCCUPANCY = NVML_GPM_METRIC_SM_OCCUPANCY + GPM_METRIC_INTEGER_UTIL = NVML_GPM_METRIC_INTEGER_UTIL + GPM_METRIC_ANY_TENSOR_UTIL = NVML_GPM_METRIC_ANY_TENSOR_UTIL + GPM_METRIC_DFMA_TENSOR_UTIL = NVML_GPM_METRIC_DFMA_TENSOR_UTIL + GPM_METRIC_HMMA_TENSOR_UTIL = NVML_GPM_METRIC_HMMA_TENSOR_UTIL + GPM_METRIC_IMMA_TENSOR_UTIL = NVML_GPM_METRIC_IMMA_TENSOR_UTIL + GPM_METRIC_DRAM_BW_UTIL = NVML_GPM_METRIC_DRAM_BW_UTIL + GPM_METRIC_FP64_UTIL = NVML_GPM_METRIC_FP64_UTIL + GPM_METRIC_FP32_UTIL = NVML_GPM_METRIC_FP32_UTIL + GPM_METRIC_FP16_UTIL = NVML_GPM_METRIC_FP16_UTIL + GPM_METRIC_PCIE_TX_PER_SEC = NVML_GPM_METRIC_PCIE_TX_PER_SEC + GPM_METRIC_PCIE_RX_PER_SEC = NVML_GPM_METRIC_PCIE_RX_PER_SEC + GPM_METRIC_NVDEC_0_UTIL = NVML_GPM_METRIC_NVDEC_0_UTIL + GPM_METRIC_NVDEC_1_UTIL = NVML_GPM_METRIC_NVDEC_1_UTIL + GPM_METRIC_NVDEC_2_UTIL = NVML_GPM_METRIC_NVDEC_2_UTIL + GPM_METRIC_NVDEC_3_UTIL = NVML_GPM_METRIC_NVDEC_3_UTIL + GPM_METRIC_NVDEC_4_UTIL = NVML_GPM_METRIC_NVDEC_4_UTIL + GPM_METRIC_NVDEC_5_UTIL = NVML_GPM_METRIC_NVDEC_5_UTIL + GPM_METRIC_NVDEC_6_UTIL = NVML_GPM_METRIC_NVDEC_6_UTIL + GPM_METRIC_NVDEC_7_UTIL = NVML_GPM_METRIC_NVDEC_7_UTIL + GPM_METRIC_NVJPG_0_UTIL = NVML_GPM_METRIC_NVJPG_0_UTIL + GPM_METRIC_NVJPG_1_UTIL = NVML_GPM_METRIC_NVJPG_1_UTIL + GPM_METRIC_NVJPG_2_UTIL = NVML_GPM_METRIC_NVJPG_2_UTIL + GPM_METRIC_NVJPG_3_UTIL = NVML_GPM_METRIC_NVJPG_3_UTIL + GPM_METRIC_NVJPG_4_UTIL = NVML_GPM_METRIC_NVJPG_4_UTIL + GPM_METRIC_NVJPG_5_UTIL = NVML_GPM_METRIC_NVJPG_5_UTIL + GPM_METRIC_NVJPG_6_UTIL = NVML_GPM_METRIC_NVJPG_6_UTIL + GPM_METRIC_NVJPG_7_UTIL = NVML_GPM_METRIC_NVJPG_7_UTIL + GPM_METRIC_NVOFA_0_UTIL = NVML_GPM_METRIC_NVOFA_0_UTIL + GPM_METRIC_NVOFA_1_UTIL = NVML_GPM_METRIC_NVOFA_1_UTIL + GPM_METRIC_NVLINK_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_TOTAL_RX_PER_SEC + GPM_METRIC_NVLINK_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_TOTAL_TX_PER_SEC + GPM_METRIC_NVLINK_L0_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L0_RX_PER_SEC + GPM_METRIC_NVLINK_L0_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L0_TX_PER_SEC + GPM_METRIC_NVLINK_L1_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L1_RX_PER_SEC + GPM_METRIC_NVLINK_L1_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L1_TX_PER_SEC + GPM_METRIC_NVLINK_L2_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L2_RX_PER_SEC + GPM_METRIC_NVLINK_L2_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L2_TX_PER_SEC + GPM_METRIC_NVLINK_L3_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L3_RX_PER_SEC + GPM_METRIC_NVLINK_L3_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L3_TX_PER_SEC + GPM_METRIC_NVLINK_L4_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L4_RX_PER_SEC + GPM_METRIC_NVLINK_L4_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L4_TX_PER_SEC + GPM_METRIC_NVLINK_L5_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L5_RX_PER_SEC + GPM_METRIC_NVLINK_L5_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L5_TX_PER_SEC + GPM_METRIC_NVLINK_L6_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L6_RX_PER_SEC + GPM_METRIC_NVLINK_L6_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L6_TX_PER_SEC + GPM_METRIC_NVLINK_L7_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L7_RX_PER_SEC + GPM_METRIC_NVLINK_L7_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L7_TX_PER_SEC + GPM_METRIC_NVLINK_L8_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L8_RX_PER_SEC + GPM_METRIC_NVLINK_L8_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L8_TX_PER_SEC + GPM_METRIC_NVLINK_L9_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L9_RX_PER_SEC + GPM_METRIC_NVLINK_L9_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L9_TX_PER_SEC + GPM_METRIC_NVLINK_L10_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L10_RX_PER_SEC + GPM_METRIC_NVLINK_L10_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L10_TX_PER_SEC + GPM_METRIC_NVLINK_L11_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L11_RX_PER_SEC + GPM_METRIC_NVLINK_L11_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L11_TX_PER_SEC + GPM_METRIC_NVLINK_L12_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L12_RX_PER_SEC + GPM_METRIC_NVLINK_L12_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L12_TX_PER_SEC + GPM_METRIC_NVLINK_L13_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L13_RX_PER_SEC + GPM_METRIC_NVLINK_L13_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L13_TX_PER_SEC + GPM_METRIC_NVLINK_L14_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L14_RX_PER_SEC + GPM_METRIC_NVLINK_L14_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L14_TX_PER_SEC + GPM_METRIC_NVLINK_L15_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L15_RX_PER_SEC + GPM_METRIC_NVLINK_L15_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L15_TX_PER_SEC + GPM_METRIC_NVLINK_L16_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L16_RX_PER_SEC + GPM_METRIC_NVLINK_L16_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L16_TX_PER_SEC + GPM_METRIC_NVLINK_L17_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L17_RX_PER_SEC + GPM_METRIC_NVLINK_L17_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L17_TX_PER_SEC + GPM_METRIC_C2C_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_DATA_TX_PER_SEC + GPM_METRIC_C2C_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK0_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK0_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK0_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK0_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK0_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK0_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK0_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK0_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK1_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK1_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK1_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK1_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK1_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK1_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK1_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK1_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK2_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK2_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK2_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK2_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK2_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK2_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK2_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK2_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK3_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK3_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK3_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK3_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK3_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK3_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK3_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK3_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK4_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK4_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK4_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK4_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK4_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK4_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK4_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK4_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK5_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK5_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK5_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK5_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK5_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK5_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK5_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK5_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK6_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK6_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK6_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK6_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK6_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK6_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK6_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK6_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK7_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK7_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK7_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK7_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK7_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK7_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK7_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK7_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK8_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK8_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK8_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK8_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK8_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK8_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK8_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK8_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK9_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK9_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK9_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK9_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK9_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK9_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK9_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK9_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK10_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK10_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK10_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK10_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK10_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK10_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK10_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK10_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK11_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK11_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK11_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK11_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK11_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK11_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK11_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK11_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK12_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK12_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK12_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK12_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK12_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK12_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK12_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK12_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK13_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK13_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK13_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK13_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK13_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK13_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK13_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK13_DATA_RX_PER_SEC + GPM_METRIC_HOSTMEM_CACHE_HIT = NVML_GPM_METRIC_HOSTMEM_CACHE_HIT + GPM_METRIC_HOSTMEM_CACHE_MISS = NVML_GPM_METRIC_HOSTMEM_CACHE_MISS + GPM_METRIC_PEERMEM_CACHE_HIT = NVML_GPM_METRIC_PEERMEM_CACHE_HIT + GPM_METRIC_PEERMEM_CACHE_MISS = NVML_GPM_METRIC_PEERMEM_CACHE_MISS + GPM_METRIC_DRAM_CACHE_HIT = NVML_GPM_METRIC_DRAM_CACHE_HIT + GPM_METRIC_DRAM_CACHE_MISS = NVML_GPM_METRIC_DRAM_CACHE_MISS + GPM_METRIC_NVENC_0_UTIL = NVML_GPM_METRIC_NVENC_0_UTIL + GPM_METRIC_NVENC_1_UTIL = NVML_GPM_METRIC_NVENC_1_UTIL + GPM_METRIC_NVENC_2_UTIL = NVML_GPM_METRIC_NVENC_2_UTIL + GPM_METRIC_NVENC_3_UTIL = NVML_GPM_METRIC_NVENC_3_UTIL + GPM_METRIC_GR0_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR0_CTXSW_CYCLES_ELAPSED + GPM_METRIC_GR0_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR0_CTXSW_CYCLES_ACTIVE + GPM_METRIC_GR0_CTXSW_REQUESTS = NVML_GPM_METRIC_GR0_CTXSW_REQUESTS + GPM_METRIC_GR0_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR0_CTXSW_CYCLES_PER_REQ + GPM_METRIC_GR0_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR0_CTXSW_ACTIVE_PCT + GPM_METRIC_GR1_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR1_CTXSW_CYCLES_ELAPSED + GPM_METRIC_GR1_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR1_CTXSW_CYCLES_ACTIVE + GPM_METRIC_GR1_CTXSW_REQUESTS = NVML_GPM_METRIC_GR1_CTXSW_REQUESTS + GPM_METRIC_GR1_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR1_CTXSW_CYCLES_PER_REQ + GPM_METRIC_GR1_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR1_CTXSW_ACTIVE_PCT + GPM_METRIC_GR2_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR2_CTXSW_CYCLES_ELAPSED + GPM_METRIC_GR2_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR2_CTXSW_CYCLES_ACTIVE + GPM_METRIC_GR2_CTXSW_REQUESTS = NVML_GPM_METRIC_GR2_CTXSW_REQUESTS + GPM_METRIC_GR2_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR2_CTXSW_CYCLES_PER_REQ + GPM_METRIC_GR2_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR2_CTXSW_ACTIVE_PCT + GPM_METRIC_GR3_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR3_CTXSW_CYCLES_ELAPSED + GPM_METRIC_GR3_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR3_CTXSW_CYCLES_ACTIVE + GPM_METRIC_GR3_CTXSW_REQUESTS = NVML_GPM_METRIC_GR3_CTXSW_REQUESTS + GPM_METRIC_GR3_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR3_CTXSW_CYCLES_PER_REQ + GPM_METRIC_GR3_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR3_CTXSW_ACTIVE_PCT + GPM_METRIC_GR4_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR4_CTXSW_CYCLES_ELAPSED + GPM_METRIC_GR4_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR4_CTXSW_CYCLES_ACTIVE + GPM_METRIC_GR4_CTXSW_REQUESTS = NVML_GPM_METRIC_GR4_CTXSW_REQUESTS + GPM_METRIC_GR4_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR4_CTXSW_CYCLES_PER_REQ + GPM_METRIC_GR4_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR4_CTXSW_ACTIVE_PCT + GPM_METRIC_GR5_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR5_CTXSW_CYCLES_ELAPSED + GPM_METRIC_GR5_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR5_CTXSW_CYCLES_ACTIVE + GPM_METRIC_GR5_CTXSW_REQUESTS = NVML_GPM_METRIC_GR5_CTXSW_REQUESTS + GPM_METRIC_GR5_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR5_CTXSW_CYCLES_PER_REQ + GPM_METRIC_GR5_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR5_CTXSW_ACTIVE_PCT + GPM_METRIC_GR6_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR6_CTXSW_CYCLES_ELAPSED + GPM_METRIC_GR6_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR6_CTXSW_CYCLES_ACTIVE + GPM_METRIC_GR6_CTXSW_REQUESTS = NVML_GPM_METRIC_GR6_CTXSW_REQUESTS + GPM_METRIC_GR6_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR6_CTXSW_CYCLES_PER_REQ + GPM_METRIC_GR6_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR6_CTXSW_ACTIVE_PCT + GPM_METRIC_GR7_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR7_CTXSW_CYCLES_ELAPSED + GPM_METRIC_GR7_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR7_CTXSW_CYCLES_ACTIVE + GPM_METRIC_GR7_CTXSW_REQUESTS = NVML_GPM_METRIC_GR7_CTXSW_REQUESTS + GPM_METRIC_GR7_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR7_CTXSW_CYCLES_PER_REQ + GPM_METRIC_GR7_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR7_CTXSW_ACTIVE_PCT + GPM_METRIC_MAX = NVML_GPM_METRIC_MAX + +class PowerProfileType(_IntEnum): + """See `nvmlPowerProfileType_t`.""" + POWER_PROFILE_MAX_P = NVML_POWER_PROFILE_MAX_P + POWER_PROFILE_MAX_Q = NVML_POWER_PROFILE_MAX_Q + POWER_PROFILE_COMPUTE = NVML_POWER_PROFILE_COMPUTE + POWER_PROFILE_MEMORY_BOUND = NVML_POWER_PROFILE_MEMORY_BOUND + POWER_PROFILE_NETWORK = NVML_POWER_PROFILE_NETWORK + POWER_PROFILE_BALANCED = NVML_POWER_PROFILE_BALANCED + POWER_PROFILE_LLM_INFERENCE = NVML_POWER_PROFILE_LLM_INFERENCE + POWER_PROFILE_LLM_TRAINING = NVML_POWER_PROFILE_LLM_TRAINING + POWER_PROFILE_RBM = NVML_POWER_PROFILE_RBM + POWER_PROFILE_DCPCIE = NVML_POWER_PROFILE_DCPCIE + POWER_PROFILE_HMMA_SPARSE = NVML_POWER_PROFILE_HMMA_SPARSE + POWER_PROFILE_HMMA_DENSE = NVML_POWER_PROFILE_HMMA_DENSE + POWER_PROFILE_SYNC_BALANCED = NVML_POWER_PROFILE_SYNC_BALANCED + POWER_PROFILE_HPC = NVML_POWER_PROFILE_HPC + POWER_PROFILE_MIG = NVML_POWER_PROFILE_MIG + POWER_PROFILE_MAX = NVML_POWER_PROFILE_MAX + +class DeviceAddressingModeType(_IntEnum): + """See `nvmlDeviceAddressingModeType_t`.""" + DEVICE_ADDRESSING_MODE_NONE = NVML_DEVICE_ADDRESSING_MODE_NONE + DEVICE_ADDRESSING_MODE_HMM = NVML_DEVICE_ADDRESSING_MODE_HMM + DEVICE_ADDRESSING_MODE_ATS = NVML_DEVICE_ADDRESSING_MODE_ATS + +############################################################################### +# 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 TimeoutError(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 MemoryError(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 TimeoutError(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 MemoryError(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 +############################################################################### + + +pci_info_ext_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("domain", _numpy.uint32, ), + ("bus", _numpy.uint32, ), + ("device_", _numpy.uint32, ), + ("pci_device_id", _numpy.uint32, ), + ("pci_sub_system_id", _numpy.uint32, ), + ("base_class", _numpy.uint32, ), + ("sub_class", _numpy.uint32, ), + ("bus_id", _numpy.int8, (32,)), + ], align=True) + + +cdef class PciInfoExt_v1: + """Empty-initialize an instance of `nvmlPciInfoExt_v1_t`. + + + .. seealso:: `nvmlPciInfoExt_v1_t` + """ + cdef: + nvmlPciInfoExt_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlPciInfoExt_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PciInfoExt_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlPciInfoExt_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlPciInfoExt_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PciInfoExt_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPciInfoExt_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 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 + memcpy((self._ptr[0].busId), ptr, 32) + + @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 __from_data(data, "pci_info_ext_v1_dtype", pci_info_ext_v1_dtype, PciInfoExt_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlPciInfoExt_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating PciInfoExt_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlPciInfoExt_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +pci_info_dtype = _numpy.dtype([ + ("bus_id_legacy", _numpy.int8, (16,)), + ("domain", _numpy.uint32, ), + ("bus", _numpy.uint32, ), + ("device_", _numpy.uint32, ), + ("pci_device_id", _numpy.uint32, ), + ("pci_sub_system_id", _numpy.uint32, ), + ("bus_id", _numpy.int8, (32,)), + ], align=True) + + +cdef class PciInfo: + """Empty-initialize an instance of `nvmlPciInfo_t`. + + + .. seealso:: `nvmlPciInfo_t` + """ + cdef: + nvmlPciInfo_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlPciInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PciInfo") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlPciInfo_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlPciInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PciInfo") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPciInfo_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def bus_id_legacy(self): + """~_numpy.int8: (array of length 16).""" + return 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 + 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 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 + memcpy((self._ptr[0].busId), ptr, 32) + + @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 __from_data(data, "pci_info_dtype", pci_info_dtype, PciInfo.from_ptr) + + @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 = malloc(sizeof(nvmlPciInfo_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating PciInfo") + memcpy((obj._ptr), ptr, sizeof(nvmlPciInfo_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +utilization_dtype = _numpy.dtype([ + ("gpu", _numpy.uint32, ), + ("memory", _numpy.uint32, ), + ], align=True) + + +cdef class Utilization: + """Empty-initialize an instance of `nvmlUtilization_t`. + + + .. seealso:: `nvmlUtilization_t` + """ + cdef: + nvmlUtilization_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlUtilization_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating Utilization") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlUtilization_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlUtilization_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating Utilization") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlUtilization_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "utilization_dtype", utilization_dtype, Utilization.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlUtilization_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating Utilization") + memcpy((obj._ptr), ptr, sizeof(nvmlUtilization_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +memory_dtype = _numpy.dtype([ + ("total", _numpy.uint64, ), + ("free", _numpy.uint64, ), + ("used", _numpy.uint64, ), + ], align=True) + + +cdef class Memory: + """Empty-initialize an instance of `nvmlMemory_t`. + + + .. seealso:: `nvmlMemory_t` + """ + cdef: + nvmlMemory_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlMemory_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating Memory") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlMemory_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlMemory_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating Memory") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlMemory_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "memory_dtype", memory_dtype, Memory.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlMemory_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating Memory") + memcpy((obj._ptr), ptr, sizeof(nvmlMemory_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +memory_v2_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("total", _numpy.uint64, ), + ("reserved", _numpy.uint64, ), + ("free", _numpy.uint64, ), + ("used", _numpy.uint64, ), + ], align=True) + + +cdef class Memory_v2: + """Empty-initialize an instance of `nvmlMemory_v2_t`. + + + .. seealso:: `nvmlMemory_v2_t` + """ + cdef: + nvmlMemory_v2_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlMemory_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating Memory_v2") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlMemory_v2_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlMemory_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating Memory_v2") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlMemory_v2_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 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_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 __from_data(data, "memory_v2_dtype", memory_v2_dtype, Memory_v2.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlMemory_v2_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating Memory_v2") + memcpy((obj._ptr), ptr, sizeof(nvmlMemory_v2_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +ba_r1memory_dtype = _numpy.dtype([ + ("bar1total", _numpy.uint64, ), + ("bar1free", _numpy.uint64, ), + ("bar1_used", _numpy.uint64, ), + ], align=True) + + +cdef class BAR1Memory: + """Empty-initialize an instance of `nvmlBAR1Memory_t`. + + + .. seealso:: `nvmlBAR1Memory_t` + """ + cdef: + nvmlBAR1Memory_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlBAR1Memory_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating BAR1Memory") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlBAR1Memory_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlBAR1Memory_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating BAR1Memory") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlBAR1Memory_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def bar1total(self): + """int: """ + return self._ptr[0].bar1Total + + @bar1total.setter + def bar1total(self, val): + if self._readonly: + raise ValueError("This BAR1Memory instance is read-only") + self._ptr[0].bar1Total = val + + @property + def bar1free(self): + """int: """ + return self._ptr[0].bar1Free + + @bar1free.setter + def bar1free(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_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 __from_data(data, "ba_r1memory_dtype", ba_r1memory_dtype, BAR1Memory.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlBAR1Memory_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating BAR1Memory") + memcpy((obj._ptr), ptr, sizeof(nvmlBAR1Memory_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +process_info_dtype = _numpy.dtype([ + ("pid", _numpy.uint32, ), + ("used_gpu_memory", _numpy.uint64, ), + ("gpu_instance_id", _numpy.uint32, ), + ("compute_instance_id", _numpy.uint32, ), + ], align=True) + + +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 + + + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=process_info_dtype) + self._data = arr.view(_numpy.recarray) + 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 self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, ProcessInfo)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + @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): + 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): + 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): + 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): + self._data.compute_instance_id = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return ProcessInfo.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == process_info_dtype: + return ProcessInfo.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @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(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """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`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ProcessInfo obj = ProcessInfo.__new__(ProcessInfo) + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlProcessInfo_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=process_info_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +process_detail_v1_dtype = _numpy.dtype([ + ("pid", _numpy.uint32, ), + ("used_gpu_memory", _numpy.uint64, ), + ("gpu_instance_id", _numpy.uint32, ), + ("compute_instance_id", _numpy.uint32, ), + ("used_gpu_cc_protected_memory", _numpy.uint64, ), + ], align=True) + + +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 + + + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=process_detail_v1_dtype) + self._data = arr.view(_numpy.recarray) + 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 self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, 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()) + + @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): + 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): + 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): + 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): + 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): + self._data.used_gpu_cc_protected_memory = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return ProcessDetail_v1.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == process_detail_v1_dtype: + return ProcessDetail_v1.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @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(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """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`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ProcessDetail_v1 obj = ProcessDetail_v1.__new__(ProcessDetail_v1) + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlProcessDetail_v1_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=process_detail_v1_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +device_attributes_dtype = _numpy.dtype([ + ("multiprocessor_count", _numpy.uint32, ), + ("shared_copy_engine_count", _numpy.uint32, ), + ("shared_decoder_count", _numpy.uint32, ), + ("shared_encoder_count", _numpy.uint32, ), + ("shared_jpeg_count", _numpy.uint32, ), + ("shared_ofa_count", _numpy.uint32, ), + ("gpu_instance_slice_count", _numpy.uint32, ), + ("compute_instance_slice_count", _numpy.uint32, ), + ("memory_size_mb", _numpy.uint64, ), + ], align=True) + + +cdef class DeviceAttributes: + """Empty-initialize an instance of `nvmlDeviceAttributes_t`. + + + .. seealso:: `nvmlDeviceAttributes_t` + """ + cdef: + nvmlDeviceAttributes_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlDeviceAttributes_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating DeviceAttributes") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlDeviceAttributes_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlDeviceAttributes_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating DeviceAttributes") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlDeviceAttributes_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "device_attributes_dtype", device_attributes_dtype, DeviceAttributes.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlDeviceAttributes_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating DeviceAttributes") + memcpy((obj._ptr), ptr, sizeof(nvmlDeviceAttributes_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +c2c_mode_info_v1_dtype = _numpy.dtype([ + ("is_c2c_enabled", _numpy.uint32, ), + ], align=True) + + +cdef class C2cModeInfo_v1: + """Empty-initialize an instance of `nvmlC2cModeInfo_v1_t`. + + + .. seealso:: `nvmlC2cModeInfo_v1_t` + """ + cdef: + nvmlC2cModeInfo_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlC2cModeInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating C2cModeInfo_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlC2cModeInfo_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlC2cModeInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating C2cModeInfo_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlC2cModeInfo_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "c2c_mode_info_v1_dtype", c2c_mode_info_v1_dtype, C2cModeInfo_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlC2cModeInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating C2cModeInfo_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlC2cModeInfo_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +row_remapper_histogram_values_dtype = _numpy.dtype([ + ("max_", _numpy.uint32, ), + ("high", _numpy.uint32, ), + ("partial", _numpy.uint32, ), + ("low", _numpy.uint32, ), + ("none", _numpy.uint32, ), + ], align=True) + + +cdef class RowRemapperHistogramValues: + """Empty-initialize an instance of `nvmlRowRemapperHistogramValues_t`. + + + .. seealso:: `nvmlRowRemapperHistogramValues_t` + """ + cdef: + nvmlRowRemapperHistogramValues_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlRowRemapperHistogramValues_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating RowRemapperHistogramValues") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlRowRemapperHistogramValues_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlRowRemapperHistogramValues_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating RowRemapperHistogramValues") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlRowRemapperHistogramValues_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "row_remapper_histogram_values_dtype", row_remapper_histogram_values_dtype, RowRemapperHistogramValues.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlRowRemapperHistogramValues_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating RowRemapperHistogramValues") + memcpy((obj._ptr), ptr, sizeof(nvmlRowRemapperHistogramValues_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +bridge_chip_info_dtype = _numpy.dtype([ + ("type", _numpy.int32, ), + ("fw_version", _numpy.uint32, ), + ], align=True) + + +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 + + + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=bridge_chip_info_dtype) + self._data = arr.view(_numpy.recarray) + 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 self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, BridgeChipInfo)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + @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): + 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): + self._data.fw_version = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return BridgeChipInfo.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == bridge_chip_info_dtype: + return BridgeChipInfo.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @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(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """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`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef BridgeChipInfo obj = BridgeChipInfo.__new__(BridgeChipInfo) + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlBridgeChipInfo_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=bridge_chip_info_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +value_dtype = _numpy.dtype(( + _numpy.dtype((_numpy.void, sizeof(nvmlValue_t))), + { + "d_val": (_numpy.float64, 0), + "si_val": (_numpy.int32, 0), + "ui_val": (_numpy.uint32, 0), + "ul_val": (_numpy.uint32, 0), + "ull_val": (_numpy.uint64, 0), + "sll_val": (_numpy.int64, 0), + "us_val": (_numpy.uint16, 0), + } + )) + + +cdef class Value: + """Empty-initialize an instance of `nvmlValue_t`. + + + .. seealso:: `nvmlValue_t` + """ + cdef: + nvmlValue_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlValue_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating Value") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlValue_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlValue_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating Value") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlValue_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "value_dtype", value_dtype, Value.from_ptr) + + @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 = malloc(sizeof(nvmlValue_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating Value") + memcpy((obj._ptr), ptr, sizeof(nvmlValue_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +_py_anon_pod0_dtype = _numpy.dtype([ + ("controller", _numpy.int32, ), + ("default_min_temp", _numpy.int32, ), + ("default_max_temp", _numpy.int32, ), + ("current_temp", _numpy.int32, ), + ("target", _numpy.int32, ), + ], align=True) + + +cdef class _py_anon_pod0: + """Empty-initialize an instance of `_anon_pod0`. + + + .. seealso:: `_anon_pod0` + """ + cdef: + _anon_pod0 *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = <_anon_pod0 *>calloc(1, sizeof(_anon_pod0)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod0") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + def __repr__(self): + 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 (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef _py_anon_pod0 other_ + if not isinstance(other, _py_anon_pod0): + return False + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof(_anon_pod0)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = <_anon_pod0 *>malloc(sizeof(_anon_pod0)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod0") + memcpy(self._ptr, val.ctypes.data, sizeof(_anon_pod0)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def controller(self): + """int: """ + return (self._ptr[0].controller) + + @controller.setter + def controller(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod0 instance is read-only") + self._ptr[0].controller = val + + @property + def default_min_temp(self): + """int: """ + return self._ptr[0].defaultMinTemp + + @default_min_temp.setter + def default_min_temp(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod0 instance is read-only") + self._ptr[0].defaultMinTemp = val + + @property + def default_max_temp(self): + """int: """ + return self._ptr[0].defaultMaxTemp + + @default_max_temp.setter + def default_max_temp(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod0 instance is read-only") + self._ptr[0].defaultMaxTemp = val + + @property + def current_temp(self): + """int: """ + return self._ptr[0].currentTemp + + @current_temp.setter + def current_temp(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod0 instance is read-only") + self._ptr[0].currentTemp = val + + @property + def target(self): + """int: """ + return (self._ptr[0].target) + + @target.setter + def target(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod0 instance is read-only") + self._ptr[0].target = val + + @staticmethod + def from_data(data): + """Create an _py_anon_pod0 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod0_dtype` holding the data. + """ + return __from_data(data, "_py_anon_pod0_dtype", _py_anon_pod0_dtype, _py_anon_pod0.from_ptr) + + @staticmethod + def from_ptr(intptr_t ptr, 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. + 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_pod0 obj = _py_anon_pod0.__new__(_py_anon_pod0) + if owner is None: + obj._ptr = <_anon_pod0 *>malloc(sizeof(_anon_pod0)) + if obj._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod0") + memcpy((obj._ptr), ptr, sizeof(_anon_pod0)) + obj._owner = None + else: + obj._ptr = <_anon_pod0 *>ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +cooler_info_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("ind_ex", _numpy.uint32, ), + ("signal_type", _numpy.int32, ), + ("target", _numpy.int32, ), + ], align=True) + + +cdef class CoolerInfo_v1: + """Empty-initialize an instance of `nvmlCoolerInfo_v1_t`. + + + .. seealso:: `nvmlCoolerInfo_v1_t` + """ + cdef: + nvmlCoolerInfo_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlCoolerInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating CoolerInfo_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlCoolerInfo_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlCoolerInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating CoolerInfo_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlCoolerInfo_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 ind_ex(self): + """int: the cooler index""" + return self._ptr[0].index + + @ind_ex.setter + def ind_ex(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_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 __from_data(data, "cooler_info_v1_dtype", cooler_info_v1_dtype, CoolerInfo_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlCoolerInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating CoolerInfo_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlCoolerInfo_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +margin_temperature_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("margin_temperature", _numpy.int32, ), + ], align=True) + + +cdef class MarginTemperature_v1: + """Empty-initialize an instance of `nvmlMarginTemperature_v1_t`. + + + .. seealso:: `nvmlMarginTemperature_v1_t` + """ + cdef: + nvmlMarginTemperature_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlMarginTemperature_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating MarginTemperature_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + def __repr__(self): + return f"<{__name__}.MarginTemperature_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 MarginTemperature_v1 other_ + if not isinstance(other, MarginTemperature_v1): + return False + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof(nvmlMarginTemperature_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlMarginTemperature_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating MarginTemperature_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlMarginTemperature_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 MarginTemperature_v1 instance is read-only") + self._ptr[0].version = val + + @property + def margin_temperature(self): + """int: The margin temperature value.""" + return self._ptr[0].marginTemperature + + @margin_temperature.setter + def margin_temperature(self, val): + if self._readonly: + raise ValueError("This MarginTemperature_v1 instance is read-only") + self._ptr[0].marginTemperature = val + + @staticmethod + def from_data(data): + """Create an MarginTemperature_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `margin_temperature_v1_dtype` holding the data. + """ + return __from_data(data, "margin_temperature_v1_dtype", margin_temperature_v1_dtype, MarginTemperature_v1.from_ptr) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an MarginTemperature_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 MarginTemperature_v1 obj = MarginTemperature_v1.__new__(MarginTemperature_v1) + if owner is None: + obj._ptr = malloc(sizeof(nvmlMarginTemperature_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating MarginTemperature_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlMarginTemperature_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +clk_mon_fault_info_dtype = _numpy.dtype([ + ("clk_api_domain", _numpy.uint32, ), + ("clk_domain_fault_mask", _numpy.uint32, ), + ], align=True) + + +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 + + + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=clk_mon_fault_info_dtype) + self._data = arr.view(_numpy.recarray) + 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 self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, ClkMonFaultInfo)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + @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): + 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): + self._data.clk_domain_fault_mask = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return ClkMonFaultInfo.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == clk_mon_fault_info_dtype: + return ClkMonFaultInfo.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @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(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """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`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ClkMonFaultInfo obj = ClkMonFaultInfo.__new__(ClkMonFaultInfo) + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlClkMonFaultInfo_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=clk_mon_fault_info_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +clock_offset_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("type", _numpy.int32, ), + ("pstate", _numpy.int32, ), + ("clock_offset_m_hz", _numpy.int32, ), + ("min_clock_offset_m_hz", _numpy.int32, ), + ("max_clock_offset_m_hz", _numpy.int32, ), + ], align=True) + + +cdef class ClockOffset_v1: + """Empty-initialize an instance of `nvmlClockOffset_v1_t`. + + + .. seealso:: `nvmlClockOffset_v1_t` + """ + cdef: + nvmlClockOffset_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlClockOffset_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ClockOffset_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlClockOffset_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlClockOffset_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ClockOffset_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlClockOffset_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "clock_offset_v1_dtype", clock_offset_v1_dtype, ClockOffset_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlClockOffset_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ClockOffset_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlClockOffset_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +fan_speed_info_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("fan", _numpy.uint32, ), + ("speed", _numpy.uint32, ), + ], align=True) + + +cdef class FanSpeedInfo_v1: + """Empty-initialize an instance of `nvmlFanSpeedInfo_v1_t`. + + + .. seealso:: `nvmlFanSpeedInfo_v1_t` + """ + cdef: + nvmlFanSpeedInfo_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlFanSpeedInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating FanSpeedInfo_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + def __repr__(self): + return f"<{__name__}.FanSpeedInfo_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 FanSpeedInfo_v1 other_ + if not isinstance(other, FanSpeedInfo_v1): + return False + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof(nvmlFanSpeedInfo_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlFanSpeedInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating FanSpeedInfo_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlFanSpeedInfo_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 FanSpeedInfo_v1 instance is read-only") + self._ptr[0].version = val + + @property + def fan(self): + """int: the fan index""" + return self._ptr[0].fan + + @fan.setter + def fan(self, val): + if self._readonly: + raise ValueError("This FanSpeedInfo_v1 instance is read-only") + self._ptr[0].fan = val + + @property + def speed(self): + """int: OUT: the fan speed in RPM.""" + return self._ptr[0].speed + + @speed.setter + def speed(self, val): + if self._readonly: + raise ValueError("This FanSpeedInfo_v1 instance is read-only") + self._ptr[0].speed = val + + @staticmethod + def from_data(data): + """Create an FanSpeedInfo_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `fan_speed_info_v1_dtype` holding the data. + """ + return __from_data(data, "fan_speed_info_v1_dtype", fan_speed_info_v1_dtype, FanSpeedInfo_v1.from_ptr) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an FanSpeedInfo_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 FanSpeedInfo_v1 obj = FanSpeedInfo_v1.__new__(FanSpeedInfo_v1) + if owner is None: + obj._ptr = malloc(sizeof(nvmlFanSpeedInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating FanSpeedInfo_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlFanSpeedInfo_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +device_perf_modes_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("str", _numpy.int8, (2048,)), + ], align=True) + + +cdef class DevicePerfModes_v1: + """Empty-initialize an instance of `nvmlDevicePerfModes_v1_t`. + + + .. seealso:: `nvmlDevicePerfModes_v1_t` + """ + cdef: + nvmlDevicePerfModes_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlDevicePerfModes_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating DevicePerfModes_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + def __repr__(self): + return f"<{__name__}.DevicePerfModes_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 DevicePerfModes_v1 other_ + if not isinstance(other, DevicePerfModes_v1): + return False + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof(nvmlDevicePerfModes_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlDevicePerfModes_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating DevicePerfModes_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlDevicePerfModes_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 DevicePerfModes_v1 instance is read-only") + self._ptr[0].version = val + + @property + def str(self): + """~_numpy.int8: (array of length 2048).OUT: the performance modes string.""" + return cpython.PyUnicode_FromString(self._ptr[0].str) + + @str.setter + def str(self, val): + if self._readonly: + raise ValueError("This DevicePerfModes_v1 instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 2048: + raise ValueError("String too long for field str, max length is 2047") + cdef char *ptr = buf + memcpy((self._ptr[0].str), ptr, 2048) + + @staticmethod + def from_data(data): + """Create an DevicePerfModes_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `device_perf_modes_v1_dtype` holding the data. + """ + return __from_data(data, "device_perf_modes_v1_dtype", device_perf_modes_v1_dtype, DevicePerfModes_v1.from_ptr) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an DevicePerfModes_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 DevicePerfModes_v1 obj = DevicePerfModes_v1.__new__(DevicePerfModes_v1) + if owner is None: + obj._ptr = malloc(sizeof(nvmlDevicePerfModes_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating DevicePerfModes_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlDevicePerfModes_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +device_current_clock_freqs_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("str", _numpy.int8, (2048,)), + ], align=True) + + +cdef class DeviceCurrentClockFreqs_v1: + """Empty-initialize an instance of `nvmlDeviceCurrentClockFreqs_v1_t`. + + + .. seealso:: `nvmlDeviceCurrentClockFreqs_v1_t` + """ + cdef: + nvmlDeviceCurrentClockFreqs_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlDeviceCurrentClockFreqs_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating DeviceCurrentClockFreqs_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + def __repr__(self): + return f"<{__name__}.DeviceCurrentClockFreqs_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 DeviceCurrentClockFreqs_v1 other_ + if not isinstance(other, DeviceCurrentClockFreqs_v1): + return False + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof(nvmlDeviceCurrentClockFreqs_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlDeviceCurrentClockFreqs_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating DeviceCurrentClockFreqs_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlDeviceCurrentClockFreqs_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 DeviceCurrentClockFreqs_v1 instance is read-only") + self._ptr[0].version = val + + @property + def str(self): + """~_numpy.int8: (array of length 2048).OUT: the current clock frequency string.""" + return cpython.PyUnicode_FromString(self._ptr[0].str) + + @str.setter + def str(self, val): + if self._readonly: + raise ValueError("This DeviceCurrentClockFreqs_v1 instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 2048: + raise ValueError("String too long for field str, max length is 2047") + cdef char *ptr = buf + memcpy((self._ptr[0].str), ptr, 2048) + + @staticmethod + def from_data(data): + """Create an DeviceCurrentClockFreqs_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `device_current_clock_freqs_v1_dtype` holding the data. + """ + return __from_data(data, "device_current_clock_freqs_v1_dtype", device_current_clock_freqs_v1_dtype, DeviceCurrentClockFreqs_v1.from_ptr) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an DeviceCurrentClockFreqs_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 DeviceCurrentClockFreqs_v1 obj = DeviceCurrentClockFreqs_v1.__new__(DeviceCurrentClockFreqs_v1) + if owner is None: + obj._ptr = malloc(sizeof(nvmlDeviceCurrentClockFreqs_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating DeviceCurrentClockFreqs_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlDeviceCurrentClockFreqs_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +process_utilization_sample_dtype = _numpy.dtype([ + ("pid", _numpy.uint32, ), + ("time_stamp", _numpy.uint64, ), + ("sm_util", _numpy.uint32, ), + ("mem_util", _numpy.uint32, ), + ("enc_util", _numpy.uint32, ), + ("dec_util", _numpy.uint32, ), + ], align=True) + + +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 + + + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=process_utilization_sample_dtype) + self._data = arr.view(_numpy.recarray) + 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 self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, ProcessUtilizationSample)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + @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): + 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): + 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): + 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): + 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): + 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): + self._data.dec_util = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return ProcessUtilizationSample.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == process_utilization_sample_dtype: + return ProcessUtilizationSample.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @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(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """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`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ProcessUtilizationSample obj = ProcessUtilizationSample.__new__(ProcessUtilizationSample) + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlProcessUtilizationSample_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=process_utilization_sample_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +process_utilization_info_v1_dtype = _numpy.dtype([ + ("time_stamp", _numpy.uint64, ), + ("pid", _numpy.uint32, ), + ("sm_util", _numpy.uint32, ), + ("mem_util", _numpy.uint32, ), + ("enc_util", _numpy.uint32, ), + ("dec_util", _numpy.uint32, ), + ("jpg_util", _numpy.uint32, ), + ("ofa_util", _numpy.uint32, ), + ], align=True) + + +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 + + + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=process_utilization_info_v1_dtype) + self._data = arr.view(_numpy.recarray) + 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 self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, 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()) + + @property + def time_stamp(self): + """Union[~_numpy.uint64, int]: CPU Timestamp in microseconds.""" + if self._data.size == 1: + return int(self._data.time_stamp[0]) + return self._data.time_stamp + + @time_stamp.setter + def time_stamp(self, val): + self._data.time_stamp = val + + @property + def 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): + self._data.pid = val + + @property + def sm_util(self): + """Union[~_numpy.uint32, int]: SM (3D/Compute) Util Value.""" + if self._data.size == 1: + return int(self._data.sm_util[0]) + return self._data.sm_util + + @sm_util.setter + def sm_util(self, val): + self._data.sm_util = val + + @property + def mem_util(self): + """Union[~_numpy.uint32, int]: Frame Buffer Memory Util Value.""" + if self._data.size == 1: + return int(self._data.mem_util[0]) + return self._data.mem_util + + @mem_util.setter + def mem_util(self, val): + self._data.mem_util = val + + @property + def enc_util(self): + """Union[~_numpy.uint32, int]: Encoder Util Value.""" + if self._data.size == 1: + return int(self._data.enc_util[0]) + return self._data.enc_util + + @enc_util.setter + def enc_util(self, val): + self._data.enc_util = val + + @property + def dec_util(self): + """Union[~_numpy.uint32, int]: Decoder Util Value.""" + if self._data.size == 1: + return int(self._data.dec_util[0]) + return self._data.dec_util + + @dec_util.setter + def dec_util(self, val): + self._data.dec_util = val + + @property + def jpg_util(self): + """Union[~_numpy.uint32, int]: Jpeg Util Value.""" + if self._data.size == 1: + return int(self._data.jpg_util[0]) + return self._data.jpg_util + + @jpg_util.setter + def jpg_util(self, val): + self._data.jpg_util = val + + @property + def ofa_util(self): + """Union[~_numpy.uint32, int]: Ofa Util Value.""" + if self._data.size == 1: + return int(self._data.ofa_util[0]) + return self._data.ofa_util + + @ofa_util.setter + def ofa_util(self, val): + self._data.ofa_util = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return ProcessUtilizationInfo_v1.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == process_utilization_info_v1_dtype: + return ProcessUtilizationInfo_v1.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @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(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """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`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ProcessUtilizationInfo_v1 obj = ProcessUtilizationInfo_v1.__new__(ProcessUtilizationInfo_v1) + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlProcessUtilizationInfo_v1_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=process_utilization_info_v1_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +ecc_sram_error_status_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("aggregate_unc_parity", _numpy.uint64, ), + ("aggregate_unc_sec_ded", _numpy.uint64, ), + ("aggregate_cor", _numpy.uint64, ), + ("volatile_unc_parity", _numpy.uint64, ), + ("volatile_unc_sec_ded", _numpy.uint64, ), + ("volatile_cor", _numpy.uint64, ), + ("aggregate_unc_bucket_l2", _numpy.uint64, ), + ("aggregate_unc_bucket_sm", _numpy.uint64, ), + ("aggregate_unc_bucket_pcie", _numpy.uint64, ), + ("aggregate_unc_bucket_mcu", _numpy.uint64, ), + ("aggregate_unc_bucket_other", _numpy.uint64, ), + ("b_threshold_exceeded", _numpy.uint32, ), + ], align=True) + + +cdef class EccSramErrorStatus_v1: + """Empty-initialize an instance of `nvmlEccSramErrorStatus_v1_t`. + + + .. seealso:: `nvmlEccSramErrorStatus_v1_t` + """ + cdef: + nvmlEccSramErrorStatus_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlEccSramErrorStatus_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating EccSramErrorStatus_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlEccSramErrorStatus_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlEccSramErrorStatus_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating EccSramErrorStatus_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlEccSramErrorStatus_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "ecc_sram_error_status_v1_dtype", ecc_sram_error_status_v1_dtype, EccSramErrorStatus_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlEccSramErrorStatus_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating EccSramErrorStatus_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlEccSramErrorStatus_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +platform_info_v2_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("ib_guid", _numpy.uint8, (16,)), + ("chassis_serial_number", _numpy.uint8, (16,)), + ("slot_number", _numpy.uint8, ), + ("tray_ind_ex", _numpy.uint8, ), + ("host_id", _numpy.uint8, ), + ("peer_type", _numpy.uint8, ), + ("module_id", _numpy.uint8, ), + ], align=True) + + +cdef class PlatformInfo_v2: + """Empty-initialize an instance of `nvmlPlatformInfo_v2_t`. + + + .. seealso:: `nvmlPlatformInfo_v2_t` + """ + cdef: + nvmlPlatformInfo_v2_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlPlatformInfo_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PlatformInfo_v2") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlPlatformInfo_v2_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlPlatformInfo_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PlatformInfo_v2") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPlatformInfo_v2_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 view.array arr = view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].ibGuid)) + return arr + + @ib_guid.setter + def ib_guid(self, val): + if self._readonly: + raise ValueError("This PlatformInfo_v2 instance is read-only") + cdef view.array arr = view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) + 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 view.array arr = view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].chassisSerialNumber)) + return arr + + @chassis_serial_number.setter + def chassis_serial_number(self, val): + if self._readonly: + raise ValueError("This PlatformInfo_v2 instance is read-only") + cdef view.array arr = view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) + 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_ind_ex(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_ind_ex.setter + def tray_ind_ex(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_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 __from_data(data, "platform_info_v2_dtype", platform_info_v2_dtype, PlatformInfo_v2.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlPlatformInfo_v2_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating PlatformInfo_v2") + memcpy((obj._ptr), ptr, sizeof(nvmlPlatformInfo_v2_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +_py_anon_pod1_dtype = _numpy.dtype([ + ("b_is_present", _numpy.uint32, ), + ("percentage", _numpy.uint32, ), + ("inc_threshold", _numpy.uint32, ), + ("dec_threshold", _numpy.uint32, ), + ], align=True) + + +cdef class _py_anon_pod1: + """Empty-initialize an instance of `_anon_pod1`. + + + .. seealso:: `_anon_pod1` + """ + cdef: + _anon_pod1 *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = <_anon_pod1 *>calloc(1, sizeof(_anon_pod1)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + def __repr__(self): + 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 (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef _py_anon_pod1 other_ + if not isinstance(other, _py_anon_pod1): + return False + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof(_anon_pod1)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = <_anon_pod1 *>malloc(sizeof(_anon_pod1)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod1") + memcpy(self._ptr, val.ctypes.data, sizeof(_anon_pod1)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def b_is_present(self): + """int: """ + return self._ptr[0].bIsPresent + + @b_is_present.setter + def b_is_present(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod1 instance is read-only") + self._ptr[0].bIsPresent = val + + @property + def percentage(self): + """int: """ + return self._ptr[0].percentage + + @percentage.setter + def percentage(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod1 instance is read-only") + self._ptr[0].percentage = val + + @property + def inc_threshold(self): + """int: """ + return self._ptr[0].incThreshold + + @inc_threshold.setter + def inc_threshold(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod1 instance is read-only") + self._ptr[0].incThreshold = val + + @property + def dec_threshold(self): + """int: """ + return self._ptr[0].decThreshold + + @dec_threshold.setter + def dec_threshold(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod1 instance is read-only") + self._ptr[0].decThreshold = val + + @staticmethod + def from_data(data): + """Create an _py_anon_pod1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod1_dtype` holding the data. + """ + return __from_data(data, "_py_anon_pod1_dtype", _py_anon_pod1_dtype, _py_anon_pod1.from_ptr) + + @staticmethod + def from_ptr(intptr_t ptr, 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. + 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_pod1 obj = _py_anon_pod1.__new__(_py_anon_pod1) + if owner is None: + obj._ptr = <_anon_pod1 *>malloc(sizeof(_anon_pod1)) + if obj._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod1") + memcpy((obj._ptr), ptr, sizeof(_anon_pod1)) + obj._owner = None + else: + obj._ptr = <_anon_pod1 *>ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +vgpu_heterogeneous_mode_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("mode", _numpy.uint32, ), + ], align=True) + + +cdef class VgpuHeterogeneousMode_v1: + """Empty-initialize an instance of `nvmlVgpuHeterogeneousMode_v1_t`. + + + .. seealso:: `nvmlVgpuHeterogeneousMode_v1_t` + """ + cdef: + nvmlVgpuHeterogeneousMode_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuHeterogeneousMode_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuHeterogeneousMode_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + def __repr__(self): + return f"<{__name__}.VgpuHeterogeneousMode_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 VgpuHeterogeneousMode_v1 other_ + if not isinstance(other, VgpuHeterogeneousMode_v1): + return False + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuHeterogeneousMode_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuHeterogeneousMode_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuHeterogeneousMode_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuHeterogeneousMode_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 VgpuHeterogeneousMode_v1 instance is read-only") + self._ptr[0].version = val + + @property + def mode(self): + """int: The vGPU heterogeneous mode.""" + return self._ptr[0].mode + + @mode.setter + def mode(self, val): + if self._readonly: + raise ValueError("This VgpuHeterogeneousMode_v1 instance is read-only") + self._ptr[0].mode = val + + @staticmethod + def from_data(data): + """Create an VgpuHeterogeneousMode_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_heterogeneous_mode_v1_dtype` holding the data. + """ + return __from_data(data, "vgpu_heterogeneous_mode_v1_dtype", vgpu_heterogeneous_mode_v1_dtype, VgpuHeterogeneousMode_v1.from_ptr) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuHeterogeneousMode_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 VgpuHeterogeneousMode_v1 obj = VgpuHeterogeneousMode_v1.__new__(VgpuHeterogeneousMode_v1) + if owner is None: + obj._ptr = malloc(sizeof(nvmlVgpuHeterogeneousMode_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuHeterogeneousMode_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuHeterogeneousMode_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +vgpu_placement_id_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("placement_id", _numpy.uint32, ), + ], align=True) + + +cdef class VgpuPlacementId_v1: + """Empty-initialize an instance of `nvmlVgpuPlacementId_v1_t`. + + + .. seealso:: `nvmlVgpuPlacementId_v1_t` + """ + cdef: + nvmlVgpuPlacementId_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuPlacementId_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuPlacementId_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + def __repr__(self): + return f"<{__name__}.VgpuPlacementId_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 VgpuPlacementId_v1 other_ + if not isinstance(other, VgpuPlacementId_v1): + return False + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuPlacementId_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuPlacementId_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuPlacementId_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuPlacementId_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 VgpuPlacementId_v1 instance is read-only") + self._ptr[0].version = val + + @property + def placement_id(self): + """int: Placement ID of the active vGPU instance.""" + return self._ptr[0].placementId + + @placement_id.setter + def placement_id(self, val): + if self._readonly: + raise ValueError("This VgpuPlacementId_v1 instance is read-only") + self._ptr[0].placementId = val + + @staticmethod + def from_data(data): + """Create an VgpuPlacementId_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_placement_id_v1_dtype` holding the data. + """ + return __from_data(data, "vgpu_placement_id_v1_dtype", vgpu_placement_id_v1_dtype, VgpuPlacementId_v1.from_ptr) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuPlacementId_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 VgpuPlacementId_v1 obj = VgpuPlacementId_v1.__new__(VgpuPlacementId_v1) + if owner is None: + obj._ptr = malloc(sizeof(nvmlVgpuPlacementId_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuPlacementId_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuPlacementId_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +vgpu_placement_list_v2_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("placement_size", _numpy.uint32, ), + ("count", _numpy.uint32, ), + ("placement_ids", _numpy.intp, ), + ("mode", _numpy.uint32, ), + ], align=True) + + +cdef class VgpuPlacementList_v2: + """Empty-initialize an instance of `nvmlVgpuPlacementList_v2_t`. + + + .. seealso:: `nvmlVgpuPlacementList_v2_t` + """ + cdef: + nvmlVgpuPlacementList_v2_t *_ptr + object _owner + bint _readonly + dict _refs + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuPlacementList_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuPlacementList_v2") + self._owner = None + self._readonly = False + self._refs = {} + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuPlacementList_v2_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuPlacementList_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuPlacementList_v2") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuPlacementList_v2_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 view.array arr = 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 arr + + @placement_ids.setter + def placement_ids(self, val): + if self._readonly: + raise ValueError("This VgpuPlacementList_v2 instance is read-only") + cdef view.array arr = 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_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 __from_data(data, "vgpu_placement_list_v2_dtype", vgpu_placement_list_v2_dtype, VgpuPlacementList_v2.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlVgpuPlacementList_v2_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuPlacementList_v2") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuPlacementList_v2_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + obj._refs = {} + return obj + + +vgpu_type_bar1info_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("bar1size", _numpy.uint64, ), + ], align=True) + + +cdef class VgpuTypeBar1Info_v1: + """Empty-initialize an instance of `nvmlVgpuTypeBar1Info_v1_t`. + + + .. seealso:: `nvmlVgpuTypeBar1Info_v1_t` + """ + cdef: + nvmlVgpuTypeBar1Info_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuTypeBar1Info_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuTypeBar1Info_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuTypeBar1Info_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuTypeBar1Info_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuTypeBar1Info_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuTypeBar1Info_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "vgpu_type_bar1info_v1_dtype", vgpu_type_bar1info_v1_dtype, VgpuTypeBar1Info_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlVgpuTypeBar1Info_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuTypeBar1Info_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuTypeBar1Info_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +vgpu_process_utilization_info_v1_dtype = _numpy.dtype([ + ("process_name", _numpy.int8, (64,)), + ("time_stamp", _numpy.uint64, ), + ("vgpu_instance", _numpy.uint32, ), + ("pid", _numpy.uint32, ), + ("sm_util", _numpy.uint32, ), + ("mem_util", _numpy.uint32, ), + ("enc_util", _numpy.uint32, ), + ("dec_util", _numpy.uint32, ), + ("jpg_util", _numpy.uint32, ), + ("ofa_util", _numpy.uint32, ), + ], align=True) + + +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 + + + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=vgpu_process_utilization_info_v1_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlVgpuProcessUtilizationInfo_v1_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlVgpuProcessUtilizationInfo_v1_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.VgpuProcessUtilizationInfo_v1_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.VgpuProcessUtilizationInfo_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, VgpuProcessUtilizationInfo_v1)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + @property + def process_name(self): + """~_numpy.int8: (array of length 64).Name of process running within the vGPU VM.""" + return self._data.process_name + + @process_name.setter + def process_name(self, val): + self._data.process_name = val + + @property + def time_stamp(self): + """Union[~_numpy.uint64, int]: CPU Timestamp in microseconds.""" + if self._data.size == 1: + return int(self._data.time_stamp[0]) + return self._data.time_stamp + + @time_stamp.setter + def time_stamp(self, val): + self._data.time_stamp = val + + @property + def vgpu_instance(self): + """Union[~_numpy.uint32, int]: vGPU Instance""" + if self._data.size == 1: + return int(self._data.vgpu_instance[0]) + return self._data.vgpu_instance + + @vgpu_instance.setter + def vgpu_instance(self, val): + self._data.vgpu_instance = val + + @property + def pid(self): + """Union[~_numpy.uint32, int]: PID of process running within the vGPU VM.""" + if self._data.size == 1: + return int(self._data.pid[0]) + return self._data.pid + + @pid.setter + def pid(self, val): + self._data.pid = val + + @property + def sm_util(self): + """Union[~_numpy.uint32, int]: SM (3D/Compute) Util Value.""" + if self._data.size == 1: + return int(self._data.sm_util[0]) + return self._data.sm_util + + @sm_util.setter + def sm_util(self, val): + self._data.sm_util = val + + @property + def mem_util(self): + """Union[~_numpy.uint32, int]: Frame Buffer Memory Util Value.""" + if self._data.size == 1: + return int(self._data.mem_util[0]) + return self._data.mem_util + + @mem_util.setter + def mem_util(self, val): + self._data.mem_util = val + + @property + def enc_util(self): + """Union[~_numpy.uint32, int]: Encoder Util Value.""" + if self._data.size == 1: + return int(self._data.enc_util[0]) + return self._data.enc_util + + @enc_util.setter + def enc_util(self, val): + self._data.enc_util = val + + @property + def dec_util(self): + """Union[~_numpy.uint32, int]: Decoder Util Value.""" + if self._data.size == 1: + return int(self._data.dec_util[0]) + return self._data.dec_util + + @dec_util.setter + def dec_util(self, val): + self._data.dec_util = val + + @property + def jpg_util(self): + """Union[~_numpy.uint32, int]: Jpeg Util Value.""" + if self._data.size == 1: + return int(self._data.jpg_util[0]) + return self._data.jpg_util + + @jpg_util.setter + def jpg_util(self, val): + self._data.jpg_util = val + + @property + def ofa_util(self): + """Union[~_numpy.uint32, int]: Ofa Util Value.""" + if self._data.size == 1: + return int(self._data.ofa_util[0]) + return self._data.ofa_util + + @ofa_util.setter + def ofa_util(self, val): + self._data.ofa_util = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return VgpuProcessUtilizationInfo_v1.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == vgpu_process_utilization_info_v1_dtype: + return VgpuProcessUtilizationInfo_v1.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_data(data): + """Create an VgpuProcessUtilizationInfo_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `vgpu_process_utilization_info_v1_dtype` holding the data. + """ + cdef VgpuProcessUtilizationInfo_v1 obj = VgpuProcessUtilizationInfo_v1.__new__(VgpuProcessUtilizationInfo_v1) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != vgpu_process_utilization_info_v1_dtype: + raise ValueError("data array must be of dtype vgpu_process_utilization_info_v1_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """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`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuProcessUtilizationInfo_v1 obj = VgpuProcessUtilizationInfo_v1.__new__(VgpuProcessUtilizationInfo_v1) + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlVgpuProcessUtilizationInfo_v1_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=vgpu_process_utilization_info_v1_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +vgpu_runtime_state_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("size_", _numpy.uint64, ), + ], align=True) + + +cdef class VgpuRuntimeState_v1: + """Empty-initialize an instance of `nvmlVgpuRuntimeState_v1_t`. + + + .. seealso:: `nvmlVgpuRuntimeState_v1_t` + """ + cdef: + nvmlVgpuRuntimeState_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuRuntimeState_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuRuntimeState_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + def __repr__(self): + return f"<{__name__}.VgpuRuntimeState_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 VgpuRuntimeState_v1 other_ + if not isinstance(other, VgpuRuntimeState_v1): + return False + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuRuntimeState_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuRuntimeState_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuRuntimeState_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuRuntimeState_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 VgpuRuntimeState_v1 instance is read-only") + self._ptr[0].version = val + + @property + def size_(self): + """int: OUT: The runtime state size of the vGPU instance.""" + return self._ptr[0].size + + @size_.setter + def size_(self, val): + if self._readonly: + raise ValueError("This VgpuRuntimeState_v1 instance is read-only") + self._ptr[0].size = val + + @staticmethod + def from_data(data): + """Create an VgpuRuntimeState_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_runtime_state_v1_dtype` holding the data. + """ + return __from_data(data, "vgpu_runtime_state_v1_dtype", vgpu_runtime_state_v1_dtype, VgpuRuntimeState_v1.from_ptr) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuRuntimeState_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 VgpuRuntimeState_v1 obj = VgpuRuntimeState_v1.__new__(VgpuRuntimeState_v1) + if owner is None: + obj._ptr = malloc(sizeof(nvmlVgpuRuntimeState_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuRuntimeState_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuRuntimeState_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +_py_anon_pod2_dtype = _numpy.dtype([ + ("avg_factor", _numpy.uint32, ), + ("timeslice", _numpy.uint32, ), + ], align=True) + + +cdef class _py_anon_pod2: + """Empty-initialize an instance of `_anon_pod2`. + + + .. seealso:: `_anon_pod2` + """ + cdef: + _anon_pod2 *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = <_anon_pod2 *>calloc(1, sizeof(_anon_pod2)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod2") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._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 (memcmp((self._ptr), (other_._ptr), sizeof(_anon_pod2)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = <_anon_pod2 *>malloc(sizeof(_anon_pod2)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod2") + memcpy(self._ptr, val.ctypes.data, sizeof(_anon_pod2)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "_py_anon_pod2_dtype", _py_anon_pod2_dtype, _py_anon_pod2.from_ptr) + + @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 = <_anon_pod2 *>malloc(sizeof(_anon_pod2)) + if obj._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod2") + memcpy((obj._ptr), ptr, sizeof(_anon_pod2)) + obj._owner = None + else: + obj._ptr = <_anon_pod2 *>ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +_py_anon_pod3_dtype = _numpy.dtype([ + ("timeslice", _numpy.uint32, ), + ], align=True) + + +cdef class _py_anon_pod3: + """Empty-initialize an instance of `_anon_pod3`. + + + .. seealso:: `_anon_pod3` + """ + cdef: + _anon_pod3 *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = <_anon_pod3 *>calloc(1, sizeof(_anon_pod3)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod3") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._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 (memcmp((self._ptr), (other_._ptr), sizeof(_anon_pod3)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = <_anon_pod3 *>malloc(sizeof(_anon_pod3)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod3") + memcpy(self._ptr, val.ctypes.data, sizeof(_anon_pod3)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "_py_anon_pod3_dtype", _py_anon_pod3_dtype, _py_anon_pod3.from_ptr) + + @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 = <_anon_pod3 *>malloc(sizeof(_anon_pod3)) + if obj._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod3") + memcpy((obj._ptr), ptr, sizeof(_anon_pod3)) + obj._owner = None + else: + obj._ptr = <_anon_pod3 *>ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +vgpu_scheduler_log_entry_dtype = _numpy.dtype([ + ("timestamp", _numpy.uint64, ), + ("time_run_total", _numpy.uint64, ), + ("time_run", _numpy.uint64, ), + ("sw_runlist_id", _numpy.uint32, ), + ("target_time_slice", _numpy.uint64, ), + ("cumulative_preemption_time", _numpy.uint64, ), + ], align=True) + + +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 + + + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=vgpu_scheduler_log_entry_dtype) + self._data = arr.view(_numpy.recarray) + 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 self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, VgpuSchedulerLogEntry)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + @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): + 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): + 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): + 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): + 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): + 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): + self._data.cumulative_preemption_time = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return VgpuSchedulerLogEntry.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == vgpu_scheduler_log_entry_dtype: + return VgpuSchedulerLogEntry.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @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(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """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`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuSchedulerLogEntry obj = VgpuSchedulerLogEntry.__new__(VgpuSchedulerLogEntry) + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlVgpuSchedulerLogEntry_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=vgpu_scheduler_log_entry_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +_py_anon_pod4_dtype = _numpy.dtype([ + ("avg_factor", _numpy.uint32, ), + ("frequency", _numpy.uint32, ), + ], align=True) + + +cdef class _py_anon_pod4: + """Empty-initialize an instance of `_anon_pod4`. + + + .. seealso:: `_anon_pod4` + """ + cdef: + _anon_pod4 *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = <_anon_pod4 *>calloc(1, sizeof(_anon_pod4)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod4") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._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 (memcmp((self._ptr), (other_._ptr), sizeof(_anon_pod4)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = <_anon_pod4 *>malloc(sizeof(_anon_pod4)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod4") + memcpy(self._ptr, val.ctypes.data, sizeof(_anon_pod4)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "_py_anon_pod4_dtype", _py_anon_pod4_dtype, _py_anon_pod4.from_ptr) + + @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 = <_anon_pod4 *>malloc(sizeof(_anon_pod4)) + if obj._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod4") + memcpy((obj._ptr), ptr, sizeof(_anon_pod4)) + obj._owner = None + else: + obj._ptr = <_anon_pod4 *>ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +_py_anon_pod5_dtype = _numpy.dtype([ + ("timeslice", _numpy.uint32, ), + ], align=True) + + +cdef class _py_anon_pod5: + """Empty-initialize an instance of `_anon_pod5`. + + + .. seealso:: `_anon_pod5` + """ + cdef: + _anon_pod5 *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = <_anon_pod5 *>calloc(1, sizeof(_anon_pod5)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod5") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._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 (memcmp((self._ptr), (other_._ptr), sizeof(_anon_pod5)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = <_anon_pod5 *>malloc(sizeof(_anon_pod5)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod5") + memcpy(self._ptr, val.ctypes.data, sizeof(_anon_pod5)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "_py_anon_pod5_dtype", _py_anon_pod5_dtype, _py_anon_pod5.from_ptr) + + @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 = <_anon_pod5 *>malloc(sizeof(_anon_pod5)) + if obj._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod5") + memcpy((obj._ptr), ptr, sizeof(_anon_pod5)) + obj._owner = None + else: + obj._ptr = <_anon_pod5 *>ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +vgpu_scheduler_capabilities_dtype = _numpy.dtype([ + ("supported_schedulers", _numpy.uint32, (3,)), + ("max_timeslice", _numpy.uint32, ), + ("min_timeslice", _numpy.uint32, ), + ("is_arr_mode_supported", _numpy.uint32, ), + ("max_frequency_for_arr", _numpy.uint32, ), + ("min_frequency_for_arr", _numpy.uint32, ), + ("max_avg_factor_for_arr", _numpy.uint32, ), + ("min_avg_factor_for_arr", _numpy.uint32, ), + ], align=True) + + +cdef class VgpuSchedulerCapabilities: + """Empty-initialize an instance of `nvmlVgpuSchedulerCapabilities_t`. + + + .. seealso:: `nvmlVgpuSchedulerCapabilities_t` + """ + cdef: + nvmlVgpuSchedulerCapabilities_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuSchedulerCapabilities_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerCapabilities") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerCapabilities_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuSchedulerCapabilities_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerCapabilities") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerCapabilities_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def supported_schedulers(self): + """~_numpy.uint32: (array of length 3).""" + cdef view.array arr = view.array(shape=(3,), itemsize=sizeof(unsigned int), format="I", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].supportedSchedulers)) + return arr + + @supported_schedulers.setter + def supported_schedulers(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerCapabilities instance is read-only") + cdef view.array arr = view.array(shape=(3,), itemsize=sizeof(unsigned int), format="I", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint32) + 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_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 __from_data(data, "vgpu_scheduler_capabilities_dtype", vgpu_scheduler_capabilities_dtype, VgpuSchedulerCapabilities.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlVgpuSchedulerCapabilities_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerCapabilities") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerCapabilities_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +vgpu_license_expiry_dtype = _numpy.dtype([ + ("year", _numpy.uint32, ), + ("month", _numpy.uint16, ), + ("day", _numpy.uint16, ), + ("hour", _numpy.uint16, ), + ("min_", _numpy.uint16, ), + ("sec", _numpy.uint16, ), + ("status", _numpy.uint8, ), + ], align=True) + + +cdef class VgpuLicenseExpiry: + """Empty-initialize an instance of `nvmlVgpuLicenseExpiry_t`. + + + .. seealso:: `nvmlVgpuLicenseExpiry_t` + """ + cdef: + nvmlVgpuLicenseExpiry_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuLicenseExpiry_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuLicenseExpiry") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuLicenseExpiry_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuLicenseExpiry_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuLicenseExpiry") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuLicenseExpiry_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "vgpu_license_expiry_dtype", vgpu_license_expiry_dtype, VgpuLicenseExpiry.from_ptr) + + @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 = malloc(sizeof(nvmlVgpuLicenseExpiry_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuLicenseExpiry") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuLicenseExpiry_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +grid_license_expiry_dtype = _numpy.dtype([ + ("year", _numpy.uint32, ), + ("month", _numpy.uint16, ), + ("day", _numpy.uint16, ), + ("hour", _numpy.uint16, ), + ("min_", _numpy.uint16, ), + ("sec", _numpy.uint16, ), + ("status", _numpy.uint8, ), + ], align=True) + + +cdef class GridLicenseExpiry: + """Empty-initialize an instance of `nvmlGridLicenseExpiry_t`. + + + .. seealso:: `nvmlGridLicenseExpiry_t` + """ + cdef: + nvmlGridLicenseExpiry_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlGridLicenseExpiry_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GridLicenseExpiry") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlGridLicenseExpiry_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlGridLicenseExpiry_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GridLicenseExpiry") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGridLicenseExpiry_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "grid_license_expiry_dtype", grid_license_expiry_dtype, GridLicenseExpiry.from_ptr) + + @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 = malloc(sizeof(nvmlGridLicenseExpiry_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating GridLicenseExpiry") + memcpy((obj._ptr), ptr, sizeof(nvmlGridLicenseExpiry_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +vgpu_type_id_info_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("vgpu_count", _numpy.uint32, ), + ("vgpu_type_ids", _numpy.intp, ), + ], align=True) + + +cdef class VgpuTypeIdInfo_v1: + """Empty-initialize an instance of `nvmlVgpuTypeIdInfo_v1_t`. + + + .. seealso:: `nvmlVgpuTypeIdInfo_v1_t` + """ + cdef: + nvmlVgpuTypeIdInfo_v1_t *_ptr + object _owner + bint _readonly + dict _refs + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuTypeIdInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuTypeIdInfo_v1") + self._owner = None + self._readonly = False + self._refs = {} + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuTypeIdInfo_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuTypeIdInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuTypeIdInfo_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuTypeIdInfo_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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.""" + return (self._ptr[0].vgpuTypeIds) + + @vgpu_type_ids.setter + def vgpu_type_ids(self, val): + if self._readonly: + raise ValueError("This VgpuTypeIdInfo_v1 instance is read-only") + self._ptr[0].vgpuTypeIds = val + + @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 __from_data(data, "vgpu_type_id_info_v1_dtype", vgpu_type_id_info_v1_dtype, VgpuTypeIdInfo_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlVgpuTypeIdInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuTypeIdInfo_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuTypeIdInfo_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + obj._refs = {} + return obj + + +vgpu_type_max_instance_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("vgpu_type_id", _numpy.uint32, ), + ("max_instance_per_gi", _numpy.uint32, ), + ], align=True) + + +cdef class VgpuTypeMaxInstance_v1: + """Empty-initialize an instance of `nvmlVgpuTypeMaxInstance_v1_t`. + + + .. seealso:: `nvmlVgpuTypeMaxInstance_v1_t` + """ + cdef: + nvmlVgpuTypeMaxInstance_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuTypeMaxInstance_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuTypeMaxInstance_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + def __repr__(self): + return f"<{__name__}.VgpuTypeMaxInstance_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 VgpuTypeMaxInstance_v1 other_ + if not isinstance(other, VgpuTypeMaxInstance_v1): + return False + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuTypeMaxInstance_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuTypeMaxInstance_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuTypeMaxInstance_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuTypeMaxInstance_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 VgpuTypeMaxInstance_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 VgpuTypeMaxInstance_v1 instance is read-only") + self._ptr[0].vgpuTypeId = val + + @property + def max_instance_per_gi(self): + """int: OUT: Maximum number of vGPU instances per GPU instance.""" + return self._ptr[0].maxInstancePerGI + + @max_instance_per_gi.setter + def max_instance_per_gi(self, val): + if self._readonly: + raise ValueError("This VgpuTypeMaxInstance_v1 instance is read-only") + self._ptr[0].maxInstancePerGI = val + + @staticmethod + def from_data(data): + """Create an VgpuTypeMaxInstance_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_type_max_instance_v1_dtype` holding the data. + """ + return __from_data(data, "vgpu_type_max_instance_v1_dtype", vgpu_type_max_instance_v1_dtype, VgpuTypeMaxInstance_v1.from_ptr) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuTypeMaxInstance_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 VgpuTypeMaxInstance_v1 obj = VgpuTypeMaxInstance_v1.__new__(VgpuTypeMaxInstance_v1) + if owner is None: + obj._ptr = malloc(sizeof(nvmlVgpuTypeMaxInstance_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuTypeMaxInstance_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuTypeMaxInstance_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +active_vgpu_instance_info_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("vgpu_count", _numpy.uint32, ), + ("vgpu_instances", _numpy.intp, ), + ], align=True) + + +cdef class ActiveVgpuInstanceInfo_v1: + """Empty-initialize an instance of `nvmlActiveVgpuInstanceInfo_v1_t`. + + + .. seealso:: `nvmlActiveVgpuInstanceInfo_v1_t` + """ + cdef: + nvmlActiveVgpuInstanceInfo_v1_t *_ptr + object _owner + bint _readonly + dict _refs + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ActiveVgpuInstanceInfo_v1") + self._owner = None + self._readonly = False + self._refs = {} + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ActiveVgpuInstanceInfo_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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.""" + return (self._ptr[0].vgpuInstances) + + @vgpu_instances.setter + def vgpu_instances(self, val): + if self._readonly: + raise ValueError("This ActiveVgpuInstanceInfo_v1 instance is read-only") + self._ptr[0].vgpuInstances = val + + @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 __from_data(data, "active_vgpu_instance_info_v1_dtype", active_vgpu_instance_info_v1_dtype, ActiveVgpuInstanceInfo_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ActiveVgpuInstanceInfo_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + obj._refs = {} + return obj + + +vgpu_creatable_placement_info_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("vgpu_type_id", _numpy.uint32, ), + ("count", _numpy.uint32, ), + ("placement_ids", _numpy.intp, ), + ("placement_size", _numpy.uint32, ), + ], align=True) + + +cdef class VgpuCreatablePlacementInfo_v1: + """Empty-initialize an instance of `nvmlVgpuCreatablePlacementInfo_v1_t`. + + + .. seealso:: `nvmlVgpuCreatablePlacementInfo_v1_t` + """ + cdef: + nvmlVgpuCreatablePlacementInfo_v1_t *_ptr + object _owner + bint _readonly + dict _refs + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuCreatablePlacementInfo_v1") + self._owner = None + self._readonly = False + self._refs = {} + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuCreatablePlacementInfo_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 view.array arr = 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 arr + + @placement_ids.setter + def placement_ids(self, val): + if self._readonly: + raise ValueError("This VgpuCreatablePlacementInfo_v1 instance is read-only") + cdef view.array arr = 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_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 __from_data(data, "vgpu_creatable_placement_info_v1_dtype", vgpu_creatable_placement_info_v1_dtype, VgpuCreatablePlacementInfo_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuCreatablePlacementInfo_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + obj._refs = {} + return obj + + +hwbc_entry_dtype = _numpy.dtype([ + ("hwbc_id", _numpy.uint32, ), + ("firmware_version", _numpy.int8, (32,)), + ], align=True) + + +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 + + + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=hwbc_entry_dtype) + self._data = arr.view(_numpy.recarray) + 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 self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, HwbcEntry)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + @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): + 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): + self._data.firmware_version = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return HwbcEntry.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == hwbc_entry_dtype: + return HwbcEntry.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @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(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """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`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef HwbcEntry obj = HwbcEntry.__new__(HwbcEntry) + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlHwbcEntry_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=hwbc_entry_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +led_state_dtype = _numpy.dtype([ + ("cause", _numpy.int8, (256,)), + ("color", _numpy.int32, ), + ], align=True) + + +cdef class LedState: + """Empty-initialize an instance of `nvmlLedState_t`. + + + .. seealso:: `nvmlLedState_t` + """ + cdef: + nvmlLedState_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlLedState_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating LedState") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlLedState_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlLedState_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating LedState") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlLedState_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def cause(self): + """~_numpy.int8: (array of length 256).""" + return 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 + 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_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 __from_data(data, "led_state_dtype", led_state_dtype, LedState.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlLedState_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating LedState") + memcpy((obj._ptr), ptr, sizeof(nvmlLedState_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +unit_info_dtype = _numpy.dtype([ + ("name", _numpy.int8, (96,)), + ("id", _numpy.int8, (96,)), + ("serial", _numpy.int8, (96,)), + ("firmware_version", _numpy.int8, (96,)), + ], align=True) + + +cdef class UnitInfo: + """Empty-initialize an instance of `nvmlUnitInfo_t`. + + + .. seealso:: `nvmlUnitInfo_t` + """ + cdef: + nvmlUnitInfo_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlUnitInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating UnitInfo") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlUnitInfo_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlUnitInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating UnitInfo") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlUnitInfo_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def name(self): + """~_numpy.int8: (array of length 96).""" + return 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 + memcpy((self._ptr[0].name), ptr, 96) + + @property + def id(self): + """~_numpy.int8: (array of length 96).""" + return 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 + memcpy((self._ptr[0].id), ptr, 96) + + @property + def serial(self): + """~_numpy.int8: (array of length 96).""" + return 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 + memcpy((self._ptr[0].serial), ptr, 96) + + @property + def firmware_version(self): + """~_numpy.int8: (array of length 96).""" + return 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 + memcpy((self._ptr[0].firmwareVersion), ptr, 96) + + @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 __from_data(data, "unit_info_dtype", unit_info_dtype, UnitInfo.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlUnitInfo_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating UnitInfo") + memcpy((obj._ptr), ptr, sizeof(nvmlUnitInfo_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +psu_info_dtype = _numpy.dtype([ + ("state", _numpy.int8, (256,)), + ("current", _numpy.uint32, ), + ("voltage", _numpy.uint32, ), + ("power", _numpy.uint32, ), + ], align=True) + + +cdef class PSUInfo: + """Empty-initialize an instance of `nvmlPSUInfo_t`. + + + .. seealso:: `nvmlPSUInfo_t` + """ + cdef: + nvmlPSUInfo_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlPSUInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PSUInfo") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlPSUInfo_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlPSUInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PSUInfo") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPSUInfo_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def state(self): + """~_numpy.int8: (array of length 256).""" + return 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 + 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_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 __from_data(data, "psu_info_dtype", psu_info_dtype, PSUInfo.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlPSUInfo_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating PSUInfo") + memcpy((obj._ptr), ptr, sizeof(nvmlPSUInfo_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +unit_fan_info_dtype = _numpy.dtype([ + ("speed", _numpy.uint32, ), + ("state", _numpy.int32, ), + ], align=True) + + +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 + + + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=unit_fan_info_dtype) + self._data = arr.view(_numpy.recarray) + 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 self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, UnitFanInfo)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + @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): + 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): + self._data.state = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return UnitFanInfo.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == unit_fan_info_dtype: + return UnitFanInfo.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @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(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """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`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef UnitFanInfo obj = UnitFanInfo.__new__(UnitFanInfo) + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlUnitFanInfo_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=unit_fan_info_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +event_data_dtype = _numpy.dtype([ + ("device_", _numpy.intp, ), + ("event_type", _numpy.uint64, ), + ("event_data", _numpy.uint64, ), + ("gpu_instance_id", _numpy.uint32, ), + ("compute_instance_id", _numpy.uint32, ), + ], align=True) + + +cdef class EventData: + """Empty-initialize an instance of `nvmlEventData_t`. + + + .. seealso:: `nvmlEventData_t` + """ + cdef: + nvmlEventData_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlEventData_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating EventData") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlEventData_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlEventData_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating EventData") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlEventData_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "event_data_dtype", event_data_dtype, EventData.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlEventData_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating EventData") + memcpy((obj._ptr), ptr, sizeof(nvmlEventData_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +accounting_stats_dtype = _numpy.dtype([ + ("gpu_utilization", _numpy.uint32, ), + ("memory_utilization", _numpy.uint32, ), + ("max_memory_usage", _numpy.uint64, ), + ("time", _numpy.uint64, ), + ("start_time", _numpy.uint64, ), + ("is_running", _numpy.uint32, ), + ("reserved", _numpy.uint32, (5,)), + ], align=True) + + +cdef class AccountingStats: + """Empty-initialize an instance of `nvmlAccountingStats_t`. + + + .. seealso:: `nvmlAccountingStats_t` + """ + cdef: + nvmlAccountingStats_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlAccountingStats_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating AccountingStats") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlAccountingStats_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlAccountingStats_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating AccountingStats") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlAccountingStats_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "accounting_stats_dtype", accounting_stats_dtype, AccountingStats.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlAccountingStats_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating AccountingStats") + memcpy((obj._ptr), ptr, sizeof(nvmlAccountingStats_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +encoder_session_info_dtype = _numpy.dtype([ + ("session_id", _numpy.uint32, ), + ("pid", _numpy.uint32, ), + ("vgpu_instance", _numpy.uint32, ), + ("codec_type", _numpy.int32, ), + ("h_resolution", _numpy.uint32, ), + ("v_resolution", _numpy.uint32, ), + ("average_fps", _numpy.uint32, ), + ("average_latency", _numpy.uint32, ), + ], align=True) + + +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 + + + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=encoder_session_info_dtype) + self._data = arr.view(_numpy.recarray) + 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 self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, EncoderSessionInfo)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + @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): + 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): + 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): + 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): + 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): + 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): + 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): + 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): + self._data.average_latency = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return EncoderSessionInfo.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == encoder_session_info_dtype: + return EncoderSessionInfo.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @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(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """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`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef EncoderSessionInfo obj = EncoderSessionInfo.__new__(EncoderSessionInfo) + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlEncoderSessionInfo_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=encoder_session_info_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +fbc_stats_dtype = _numpy.dtype([ + ("sessions_count", _numpy.uint32, ), + ("average_fps", _numpy.uint32, ), + ("average_latency", _numpy.uint32, ), + ], align=True) + + +cdef class FBCStats: + """Empty-initialize an instance of `nvmlFBCStats_t`. + + + .. seealso:: `nvmlFBCStats_t` + """ + cdef: + nvmlFBCStats_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlFBCStats_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating FBCStats") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlFBCStats_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlFBCStats_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating FBCStats") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlFBCStats_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "fbc_stats_dtype", fbc_stats_dtype, FBCStats.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlFBCStats_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating FBCStats") + memcpy((obj._ptr), ptr, sizeof(nvmlFBCStats_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +fbc_session_info_dtype = _numpy.dtype([ + ("session_id", _numpy.uint32, ), + ("pid", _numpy.uint32, ), + ("vgpu_instance", _numpy.uint32, ), + ("display_ordinal", _numpy.uint32, ), + ("session_type", _numpy.int32, ), + ("session_flags", _numpy.uint32, ), + ("h_max_resolution", _numpy.uint32, ), + ("v_max_resolution", _numpy.uint32, ), + ("h_resolution", _numpy.uint32, ), + ("v_resolution", _numpy.uint32, ), + ("average_fps", _numpy.uint32, ), + ("average_latency", _numpy.uint32, ), + ], align=True) + + +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 + + + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=fbc_session_info_dtype) + self._data = arr.view(_numpy.recarray) + 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 self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, FBCSessionInfo)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + @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): + 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): + 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): + 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): + 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): + 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): + 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): + 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): + 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): + 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): + 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): + 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): + self._data.average_latency = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return FBCSessionInfo.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == fbc_session_info_dtype: + return FBCSessionInfo.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @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(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """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`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef FBCSessionInfo obj = FBCSessionInfo.__new__(FBCSessionInfo) + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlFBCSessionInfo_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=fbc_session_info_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +conf_compute_system_caps_dtype = _numpy.dtype([ + ("cpu_caps", _numpy.uint32, ), + ("gpus_caps", _numpy.uint32, ), + ], align=True) + + +cdef class ConfComputeSystemCaps: + """Empty-initialize an instance of `nvmlConfComputeSystemCaps_t`. + + + .. seealso:: `nvmlConfComputeSystemCaps_t` + """ + cdef: + nvmlConfComputeSystemCaps_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlConfComputeSystemCaps_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeSystemCaps") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlConfComputeSystemCaps_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlConfComputeSystemCaps_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeSystemCaps") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeSystemCaps_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "conf_compute_system_caps_dtype", conf_compute_system_caps_dtype, ConfComputeSystemCaps.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlConfComputeSystemCaps_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ConfComputeSystemCaps") + memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeSystemCaps_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +conf_compute_system_state_dtype = _numpy.dtype([ + ("environment", _numpy.uint32, ), + ("cc_feature", _numpy.uint32, ), + ("dev_tools_mode", _numpy.uint32, ), + ], align=True) + + +cdef class ConfComputeSystemState: + """Empty-initialize an instance of `nvmlConfComputeSystemState_t`. + + + .. seealso:: `nvmlConfComputeSystemState_t` + """ + cdef: + nvmlConfComputeSystemState_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlConfComputeSystemState_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeSystemState") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlConfComputeSystemState_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlConfComputeSystemState_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeSystemState") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeSystemState_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "conf_compute_system_state_dtype", conf_compute_system_state_dtype, ConfComputeSystemState.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlConfComputeSystemState_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ConfComputeSystemState") + memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeSystemState_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +system_conf_compute_settings_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("environment", _numpy.uint32, ), + ("cc_feature", _numpy.uint32, ), + ("dev_tools_mode", _numpy.uint32, ), + ("multi_gpu_mode", _numpy.uint32, ), + ], align=True) + + +cdef class SystemConfComputeSettings_v1: + """Empty-initialize an instance of `nvmlSystemConfComputeSettings_v1_t`. + + + .. seealso:: `nvmlSystemConfComputeSettings_v1_t` + """ + cdef: + nvmlSystemConfComputeSettings_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlSystemConfComputeSettings_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating SystemConfComputeSettings_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlSystemConfComputeSettings_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlSystemConfComputeSettings_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating SystemConfComputeSettings_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlSystemConfComputeSettings_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "system_conf_compute_settings_v1_dtype", system_conf_compute_settings_v1_dtype, SystemConfComputeSettings_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlSystemConfComputeSettings_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating SystemConfComputeSettings_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlSystemConfComputeSettings_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +conf_compute_mem_size_info_dtype = _numpy.dtype([ + ("protected_mem_size_kib", _numpy.uint64, ), + ("unprotected_mem_size_kib", _numpy.uint64, ), + ], align=True) + + +cdef class ConfComputeMemSizeInfo: + """Empty-initialize an instance of `nvmlConfComputeMemSizeInfo_t`. + + + .. seealso:: `nvmlConfComputeMemSizeInfo_t` + """ + cdef: + nvmlConfComputeMemSizeInfo_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlConfComputeMemSizeInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeMemSizeInfo") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlConfComputeMemSizeInfo_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlConfComputeMemSizeInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeMemSizeInfo") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeMemSizeInfo_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "conf_compute_mem_size_info_dtype", conf_compute_mem_size_info_dtype, ConfComputeMemSizeInfo.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlConfComputeMemSizeInfo_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ConfComputeMemSizeInfo") + memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeMemSizeInfo_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +conf_compute_gpu_certificate_dtype = _numpy.dtype([ + ("cert_chain_size", _numpy.uint32, ), + ("attestation_cert_chain_size", _numpy.uint32, ), + ("cert_chain", _numpy.uint8, (4096,)), + ("attestation_cert_chain", _numpy.uint8, (5120,)), + ], align=True) + + +cdef class ConfComputeGpuCertificate: + """Empty-initialize an instance of `nvmlConfComputeGpuCertificate_t`. + + + .. seealso:: `nvmlConfComputeGpuCertificate_t` + """ + cdef: + nvmlConfComputeGpuCertificate_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlConfComputeGpuCertificate_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeGpuCertificate") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlConfComputeGpuCertificate_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlConfComputeGpuCertificate_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeGpuCertificate") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeGpuCertificate_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def cert_chain_size(self): + """int: """ + return self._ptr[0].certChainSize + + @cert_chain_size.setter + def cert_chain_size(self, val): + if self._readonly: + raise ValueError("This ConfComputeGpuCertificate instance is read-only") + self._ptr[0].certChainSize = val + + @property + def attestation_cert_chain_size(self): + """int: """ + return self._ptr[0].attestationCertChainSize + + @attestation_cert_chain_size.setter + def attestation_cert_chain_size(self, val): + if self._readonly: + raise ValueError("This ConfComputeGpuCertificate instance is read-only") + self._ptr[0].attestationCertChainSize = val + + @property + def cert_chain(self): + """~_numpy.uint8: (array of length 4096).""" + cdef view.array arr = view.array(shape=(4096,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].certChain)) + return arr + + @cert_chain.setter + def cert_chain(self, val): + if self._readonly: + raise ValueError("This ConfComputeGpuCertificate instance is read-only") + cdef view.array arr = view.array(shape=(4096,), itemsize=sizeof(unsigned char), format="B", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) + memcpy((&(self._ptr[0].certChain)), (arr.data), sizeof(unsigned char) * len(val)) + + @property + def attestation_cert_chain(self): + """~_numpy.uint8: (array of length 5120).""" + cdef view.array arr = view.array(shape=(5120,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].attestationCertChain)) + return arr + + @attestation_cert_chain.setter + def attestation_cert_chain(self, val): + if self._readonly: + raise ValueError("This ConfComputeGpuCertificate instance is read-only") + cdef view.array arr = view.array(shape=(5120,), itemsize=sizeof(unsigned char), format="B", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) + memcpy((&(self._ptr[0].attestationCertChain)), (arr.data), sizeof(unsigned char) * len(val)) + + @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 __from_data(data, "conf_compute_gpu_certificate_dtype", conf_compute_gpu_certificate_dtype, ConfComputeGpuCertificate.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlConfComputeGpuCertificate_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ConfComputeGpuCertificate") + memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeGpuCertificate_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +conf_compute_gpu_attestation_report_dtype = _numpy.dtype([ + ("is_cec_attestation_report_present", _numpy.uint32, ), + ("attestation_report_size", _numpy.uint32, ), + ("cec_attestation_report_size", _numpy.uint32, ), + ("nonce", _numpy.uint8, (32,)), + ("attestation_report", _numpy.uint8, (8192,)), + ("cec_attestation_report", _numpy.uint8, (4096,)), + ], align=True) + + +cdef class ConfComputeGpuAttestationReport: + """Empty-initialize an instance of `nvmlConfComputeGpuAttestationReport_t`. + + + .. seealso:: `nvmlConfComputeGpuAttestationReport_t` + """ + cdef: + nvmlConfComputeGpuAttestationReport_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlConfComputeGpuAttestationReport_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeGpuAttestationReport") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlConfComputeGpuAttestationReport_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlConfComputeGpuAttestationReport_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeGpuAttestationReport") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeGpuAttestationReport_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 attestation_report_size(self): + """int: """ + return self._ptr[0].attestationReportSize + + @attestation_report_size.setter + def attestation_report_size(self, val): + if self._readonly: + raise ValueError("This ConfComputeGpuAttestationReport instance is read-only") + self._ptr[0].attestationReportSize = val + + @property + def cec_attestation_report_size(self): + """int: """ + return self._ptr[0].cecAttestationReportSize + + @cec_attestation_report_size.setter + def cec_attestation_report_size(self, val): + if self._readonly: + raise ValueError("This ConfComputeGpuAttestationReport instance is read-only") + self._ptr[0].cecAttestationReportSize = val + + @property + def nonce(self): + """~_numpy.uint8: (array of length 32).""" + cdef view.array arr = view.array(shape=(32,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].nonce)) + return arr + + @nonce.setter + def nonce(self, val): + if self._readonly: + raise ValueError("This ConfComputeGpuAttestationReport instance is read-only") + cdef view.array arr = view.array(shape=(32,), itemsize=sizeof(unsigned char), format="B", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) + memcpy((&(self._ptr[0].nonce)), (arr.data), sizeof(unsigned char) * len(val)) + + @property + def attestation_report(self): + """~_numpy.uint8: (array of length 8192).""" + cdef view.array arr = view.array(shape=(8192,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].attestationReport)) + return arr + + @attestation_report.setter + def attestation_report(self, val): + if self._readonly: + raise ValueError("This ConfComputeGpuAttestationReport instance is read-only") + cdef view.array arr = view.array(shape=(8192,), itemsize=sizeof(unsigned char), format="B", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) + memcpy((&(self._ptr[0].attestationReport)), (arr.data), sizeof(unsigned char) * len(val)) + + @property + def cec_attestation_report(self): + """~_numpy.uint8: (array of length 4096).""" + cdef view.array arr = view.array(shape=(4096,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].cecAttestationReport)) + return arr + + @cec_attestation_report.setter + def cec_attestation_report(self, val): + if self._readonly: + raise ValueError("This ConfComputeGpuAttestationReport instance is read-only") + cdef view.array arr = view.array(shape=(4096,), itemsize=sizeof(unsigned char), format="B", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) + memcpy((&(self._ptr[0].cecAttestationReport)), (arr.data), sizeof(unsigned char) * len(val)) + + @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 __from_data(data, "conf_compute_gpu_attestation_report_dtype", conf_compute_gpu_attestation_report_dtype, ConfComputeGpuAttestationReport.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlConfComputeGpuAttestationReport_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ConfComputeGpuAttestationReport") + memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeGpuAttestationReport_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +conf_compute_get_key_rotation_threshold_info_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("attacker_advantage", _numpy.uint64, ), + ], align=True) + + +cdef class ConfComputeGetKeyRotationThresholdInfo_v1: + """Empty-initialize an instance of `nvmlConfComputeGetKeyRotationThresholdInfo_v1_t`. + + + .. seealso:: `nvmlConfComputeGetKeyRotationThresholdInfo_v1_t` + """ + cdef: + nvmlConfComputeGetKeyRotationThresholdInfo_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlConfComputeGetKeyRotationThresholdInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeGetKeyRotationThresholdInfo_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + def __repr__(self): + return f"<{__name__}.ConfComputeGetKeyRotationThresholdInfo_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 ConfComputeGetKeyRotationThresholdInfo_v1 other_ + if not isinstance(other, ConfComputeGetKeyRotationThresholdInfo_v1): + return False + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof(nvmlConfComputeGetKeyRotationThresholdInfo_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlConfComputeGetKeyRotationThresholdInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeGetKeyRotationThresholdInfo_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeGetKeyRotationThresholdInfo_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 ConfComputeGetKeyRotationThresholdInfo_v1 instance is read-only") + self._ptr[0].version = val + + @property + def attacker_advantage(self): + """int: """ + return self._ptr[0].attackerAdvantage + + @attacker_advantage.setter + def attacker_advantage(self, val): + if self._readonly: + raise ValueError("This ConfComputeGetKeyRotationThresholdInfo_v1 instance is read-only") + self._ptr[0].attackerAdvantage = val + + @staticmethod + def from_data(data): + """Create an ConfComputeGetKeyRotationThresholdInfo_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `conf_compute_get_key_rotation_threshold_info_v1_dtype` holding the data. + """ + return __from_data(data, "conf_compute_get_key_rotation_threshold_info_v1_dtype", conf_compute_get_key_rotation_threshold_info_v1_dtype, ConfComputeGetKeyRotationThresholdInfo_v1.from_ptr) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an ConfComputeGetKeyRotationThresholdInfo_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 ConfComputeGetKeyRotationThresholdInfo_v1 obj = ConfComputeGetKeyRotationThresholdInfo_v1.__new__(ConfComputeGetKeyRotationThresholdInfo_v1) + if owner is None: + obj._ptr = malloc(sizeof(nvmlConfComputeGetKeyRotationThresholdInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ConfComputeGetKeyRotationThresholdInfo_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeGetKeyRotationThresholdInfo_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +nvlink_supported_bw_modes_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("bw_modes", _numpy.uint8, (23,)), + ("total_bw_modes", _numpy.uint8, ), + ], align=True) + + +cdef class NvlinkSupportedBwModes_v1: + """Empty-initialize an instance of `nvmlNvlinkSupportedBwModes_v1_t`. + + + .. seealso:: `nvmlNvlinkSupportedBwModes_v1_t` + """ + cdef: + nvmlNvlinkSupportedBwModes_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlNvlinkSupportedBwModes_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvlinkSupportedBwModes_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvlinkSupportedBwModes_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlNvlinkSupportedBwModes_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvlinkSupportedBwModes_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvlinkSupportedBwModes_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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).""" + cdef view.array arr = view.array(shape=(23,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].bwModes)) + return arr + + @bw_modes.setter + def bw_modes(self, val): + if self._readonly: + raise ValueError("This NvlinkSupportedBwModes_v1 instance is read-only") + cdef view.array arr = view.array(shape=(23,), itemsize=sizeof(unsigned char), format="B", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) + memcpy((&(self._ptr[0].bwModes)), (arr.data), sizeof(unsigned char) * len(val)) + + @property + def total_bw_modes(self): + """int: """ + return self._ptr[0].totalBwModes + + @total_bw_modes.setter + def total_bw_modes(self, val): + if self._readonly: + raise ValueError("This NvlinkSupportedBwModes_v1 instance is read-only") + self._ptr[0].totalBwModes = val + + @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 __from_data(data, "nvlink_supported_bw_modes_v1_dtype", nvlink_supported_bw_modes_v1_dtype, NvlinkSupportedBwModes_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlNvlinkSupportedBwModes_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating NvlinkSupportedBwModes_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkSupportedBwModes_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +nvlink_get_bw_mode_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("b_is_best", _numpy.uint32, ), + ("bw_mode", _numpy.uint8, ), + ], align=True) + + +cdef class NvlinkGetBwMode_v1: + """Empty-initialize an instance of `nvmlNvlinkGetBwMode_v1_t`. + + + .. seealso:: `nvmlNvlinkGetBwMode_v1_t` + """ + cdef: + nvmlNvlinkGetBwMode_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlNvlinkGetBwMode_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvlinkGetBwMode_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvlinkGetBwMode_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlNvlinkGetBwMode_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvlinkGetBwMode_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvlinkGetBwMode_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "nvlink_get_bw_mode_v1_dtype", nvlink_get_bw_mode_v1_dtype, NvlinkGetBwMode_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlNvlinkGetBwMode_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating NvlinkGetBwMode_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkGetBwMode_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +nvlink_set_bw_mode_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("b_set_best", _numpy.uint32, ), + ("bw_mode", _numpy.uint8, ), + ], align=True) + + +cdef class NvlinkSetBwMode_v1: + """Empty-initialize an instance of `nvmlNvlinkSetBwMode_v1_t`. + + + .. seealso:: `nvmlNvlinkSetBwMode_v1_t` + """ + cdef: + nvmlNvlinkSetBwMode_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlNvlinkSetBwMode_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvlinkSetBwMode_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvlinkSetBwMode_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlNvlinkSetBwMode_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvlinkSetBwMode_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvlinkSetBwMode_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "nvlink_set_bw_mode_v1_dtype", nvlink_set_bw_mode_v1_dtype, NvlinkSetBwMode_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlNvlinkSetBwMode_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating NvlinkSetBwMode_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkSetBwMode_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +vgpu_version_dtype = _numpy.dtype([ + ("min_version", _numpy.uint32, ), + ("max_version", _numpy.uint32, ), + ], align=True) + + +cdef class VgpuVersion: + """Empty-initialize an instance of `nvmlVgpuVersion_t`. + + + .. seealso:: `nvmlVgpuVersion_t` + """ + cdef: + nvmlVgpuVersion_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuVersion_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuVersion") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuVersion_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuVersion_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuVersion") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuVersion_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "vgpu_version_dtype", vgpu_version_dtype, VgpuVersion.from_ptr) + + @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 = malloc(sizeof(nvmlVgpuVersion_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuVersion") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuVersion_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +vgpu_metadata_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("revision", _numpy.uint32, ), + ("guest_info_state", _numpy.int32, ), + ("guest_driver_version", _numpy.int8, (80,)), + ("host_driver_version", _numpy.int8, (80,)), + ("reserved", _numpy.uint32, (6,)), + ("vgpu_virtualization_caps", _numpy.uint32, ), + ("guest_vgpu_version", _numpy.uint32, ), + ("opaque_data_size", _numpy.uint32, ), + ("opaque_data", _numpy.int8, (4,)), + ], align=True) + + +cdef class VgpuMetadata: + """Empty-initialize an instance of `nvmlVgpuMetadata_t`. + + + .. seealso:: `nvmlVgpuMetadata_t` + """ + cdef: + nvmlVgpuMetadata_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuMetadata_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuMetadata") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuMetadata_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuMetadata_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuMetadata") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuMetadata_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 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 + memcpy((self._ptr[0].guestDriverVersion), ptr, 80) + + @property + def host_driver_version(self): + """~_numpy.int8: (array of length 80).""" + return 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 + 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 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 + memcpy((self._ptr[0].opaqueData), ptr, 4) + + @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 __from_data(data, "vgpu_metadata_dtype", vgpu_metadata_dtype, VgpuMetadata.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlVgpuMetadata_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuMetadata") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuMetadata_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +vgpu_pgpu_compatibility_dtype = _numpy.dtype([ + ("vgpu_vm_compatibility", _numpy.int32, ), + ("compatibility_limit_code", _numpy.int32, ), + ], align=True) + + +cdef class VgpuPgpuCompatibility: + """Empty-initialize an instance of `nvmlVgpuPgpuCompatibility_t`. + + + .. seealso:: `nvmlVgpuPgpuCompatibility_t` + """ + cdef: + nvmlVgpuPgpuCompatibility_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuPgpuCompatibility_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuPgpuCompatibility") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuPgpuCompatibility_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuPgpuCompatibility_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuPgpuCompatibility") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuPgpuCompatibility_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "vgpu_pgpu_compatibility_dtype", vgpu_pgpu_compatibility_dtype, VgpuPgpuCompatibility.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlVgpuPgpuCompatibility_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuPgpuCompatibility") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuPgpuCompatibility_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +gpu_instance_placement_dtype = _numpy.dtype([ + ("start", _numpy.uint32, ), + ("size_", _numpy.uint32, ), + ], align=True) + + +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 + + + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=gpu_instance_placement_dtype) + self._data = arr.view(_numpy.recarray) + 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 self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, GpuInstancePlacement)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + @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): + 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): + self._data.size_ = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return GpuInstancePlacement.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == gpu_instance_placement_dtype: + return GpuInstancePlacement.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @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(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """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`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef GpuInstancePlacement obj = GpuInstancePlacement.__new__(GpuInstancePlacement) + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlGpuInstancePlacement_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=gpu_instance_placement_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +gpu_instance_profile_info_v2_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("id", _numpy.uint32, ), + ("is_p2p_supported", _numpy.uint32, ), + ("slice_count", _numpy.uint32, ), + ("instance_count", _numpy.uint32, ), + ("multiprocessor_count", _numpy.uint32, ), + ("copy_engine_count", _numpy.uint32, ), + ("decoder_count", _numpy.uint32, ), + ("encoder_count", _numpy.uint32, ), + ("jpeg_count", _numpy.uint32, ), + ("ofa_count", _numpy.uint32, ), + ("memory_size_mb", _numpy.uint64, ), + ("name", _numpy.int8, (96,)), + ], align=True) + + +cdef class GpuInstanceProfileInfo_v2: + """Empty-initialize an instance of `nvmlGpuInstanceProfileInfo_v2_t`. + + + .. seealso:: `nvmlGpuInstanceProfileInfo_v2_t` + """ + cdef: + nvmlGpuInstanceProfileInfo_v2_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlGpuInstanceProfileInfo_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuInstanceProfileInfo_v2") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + def __repr__(self): + return f"<{__name__}.GpuInstanceProfileInfo_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 GpuInstanceProfileInfo_v2 other_ + if not isinstance(other, GpuInstanceProfileInfo_v2): + return False + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuInstanceProfileInfo_v2_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlGpuInstanceProfileInfo_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuInstanceProfileInfo_v2") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuInstanceProfileInfo_v2_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 GpuInstanceProfileInfo_v2 instance is read-only") + self._ptr[0].id = val + + @property + def is_p2p_supported(self): + """int: """ + return self._ptr[0].isP2pSupported + + @is_p2p_supported.setter + def is_p2p_supported(self, val): + if self._readonly: + raise ValueError("This GpuInstanceProfileInfo_v2 instance is read-only") + self._ptr[0].isP2pSupported = 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_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 GpuInstanceProfileInfo_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 GpuInstanceProfileInfo_v2 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_v2 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_v2 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_v2 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_v2 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_v2 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_v2 instance is read-only") + self._ptr[0].memorySizeMB = val + + @property + def name(self): + """~_numpy.int8: (array of length 96).""" + return cpython.PyUnicode_FromString(self._ptr[0].name) + + @name.setter + def name(self, val): + if self._readonly: + raise ValueError("This GpuInstanceProfileInfo_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 + memcpy((self._ptr[0].name), ptr, 96) + + @staticmethod + def from_data(data): + """Create an GpuInstanceProfileInfo_v2 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `gpu_instance_profile_info_v2_dtype` holding the data. + """ + return __from_data(data, "gpu_instance_profile_info_v2_dtype", gpu_instance_profile_info_v2_dtype, GpuInstanceProfileInfo_v2.from_ptr) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an GpuInstanceProfileInfo_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 GpuInstanceProfileInfo_v2 obj = GpuInstanceProfileInfo_v2.__new__(GpuInstanceProfileInfo_v2) + if owner is None: + obj._ptr = malloc(sizeof(nvmlGpuInstanceProfileInfo_v2_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating GpuInstanceProfileInfo_v2") + memcpy((obj._ptr), ptr, sizeof(nvmlGpuInstanceProfileInfo_v2_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +gpu_instance_profile_info_v3_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("id", _numpy.uint32, ), + ("slice_count", _numpy.uint32, ), + ("instance_count", _numpy.uint32, ), + ("multiprocessor_count", _numpy.uint32, ), + ("copy_engine_count", _numpy.uint32, ), + ("decoder_count", _numpy.uint32, ), + ("encoder_count", _numpy.uint32, ), + ("jpeg_count", _numpy.uint32, ), + ("ofa_count", _numpy.uint32, ), + ("memory_size_mb", _numpy.uint64, ), + ("name", _numpy.int8, (96,)), + ("capabilities", _numpy.uint32, ), + ], align=True) + + +cdef class GpuInstanceProfileInfo_v3: + """Empty-initialize an instance of `nvmlGpuInstanceProfileInfo_v3_t`. + + + .. seealso:: `nvmlGpuInstanceProfileInfo_v3_t` + """ + cdef: + nvmlGpuInstanceProfileInfo_v3_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlGpuInstanceProfileInfo_v3_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuInstanceProfileInfo_v3") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuInstanceProfileInfo_v3_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlGpuInstanceProfileInfo_v3_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuInstanceProfileInfo_v3") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuInstanceProfileInfo_v3_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 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 + 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_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 __from_data(data, "gpu_instance_profile_info_v3_dtype", gpu_instance_profile_info_v3_dtype, GpuInstanceProfileInfo_v3.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlGpuInstanceProfileInfo_v3_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating GpuInstanceProfileInfo_v3") + memcpy((obj._ptr), ptr, sizeof(nvmlGpuInstanceProfileInfo_v3_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +compute_instance_placement_dtype = _numpy.dtype([ + ("start", _numpy.uint32, ), + ("size_", _numpy.uint32, ), + ], align=True) + + +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 + + + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=compute_instance_placement_dtype) + self._data = arr.view(_numpy.recarray) + 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 self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, ComputeInstancePlacement)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + @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): + 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): + self._data.size_ = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return ComputeInstancePlacement.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == compute_instance_placement_dtype: + return ComputeInstancePlacement.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @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(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """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`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ComputeInstancePlacement obj = ComputeInstancePlacement.__new__(ComputeInstancePlacement) + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlComputeInstancePlacement_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=compute_instance_placement_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +compute_instance_profile_info_v2_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("id", _numpy.uint32, ), + ("slice_count", _numpy.uint32, ), + ("instance_count", _numpy.uint32, ), + ("multiprocessor_count", _numpy.uint32, ), + ("shared_copy_engine_count", _numpy.uint32, ), + ("shared_decoder_count", _numpy.uint32, ), + ("shared_encoder_count", _numpy.uint32, ), + ("shared_jpeg_count", _numpy.uint32, ), + ("shared_ofa_count", _numpy.uint32, ), + ("name", _numpy.int8, (96,)), + ], align=True) + + +cdef class ComputeInstanceProfileInfo_v2: + """Empty-initialize an instance of `nvmlComputeInstanceProfileInfo_v2_t`. + + + .. seealso:: `nvmlComputeInstanceProfileInfo_v2_t` + """ + cdef: + nvmlComputeInstanceProfileInfo_v2_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlComputeInstanceProfileInfo_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ComputeInstanceProfileInfo_v2") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlComputeInstanceProfileInfo_v2_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlComputeInstanceProfileInfo_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ComputeInstanceProfileInfo_v2") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlComputeInstanceProfileInfo_v2_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 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 + memcpy((self._ptr[0].name), ptr, 96) + + @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 __from_data(data, "compute_instance_profile_info_v2_dtype", compute_instance_profile_info_v2_dtype, ComputeInstanceProfileInfo_v2.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlComputeInstanceProfileInfo_v2_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ComputeInstanceProfileInfo_v2") + memcpy((obj._ptr), ptr, sizeof(nvmlComputeInstanceProfileInfo_v2_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +compute_instance_profile_info_v3_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("id", _numpy.uint32, ), + ("slice_count", _numpy.uint32, ), + ("instance_count", _numpy.uint32, ), + ("multiprocessor_count", _numpy.uint32, ), + ("shared_copy_engine_count", _numpy.uint32, ), + ("shared_decoder_count", _numpy.uint32, ), + ("shared_encoder_count", _numpy.uint32, ), + ("shared_jpeg_count", _numpy.uint32, ), + ("shared_ofa_count", _numpy.uint32, ), + ("name", _numpy.int8, (96,)), + ("capabilities", _numpy.uint32, ), + ], align=True) + + +cdef class ComputeInstanceProfileInfo_v3: + """Empty-initialize an instance of `nvmlComputeInstanceProfileInfo_v3_t`. + + + .. seealso:: `nvmlComputeInstanceProfileInfo_v3_t` + """ + cdef: + nvmlComputeInstanceProfileInfo_v3_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlComputeInstanceProfileInfo_v3_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ComputeInstanceProfileInfo_v3") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlComputeInstanceProfileInfo_v3_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlComputeInstanceProfileInfo_v3_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ComputeInstanceProfileInfo_v3") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlComputeInstanceProfileInfo_v3_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 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 + 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_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 __from_data(data, "compute_instance_profile_info_v3_dtype", compute_instance_profile_info_v3_dtype, ComputeInstanceProfileInfo_v3.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlComputeInstanceProfileInfo_v3_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ComputeInstanceProfileInfo_v3") + memcpy((obj._ptr), ptr, sizeof(nvmlComputeInstanceProfileInfo_v3_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +gpm_support_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("is_supported_device", _numpy.uint32, ), + ], align=True) + + +cdef class GpmSupport: + """Empty-initialize an instance of `nvmlGpmSupport_t`. + + + .. seealso:: `nvmlGpmSupport_t` + """ + cdef: + nvmlGpmSupport_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlGpmSupport_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpmSupport") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + def __repr__(self): + return f"<{__name__}.GpmSupport 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 GpmSupport other_ + if not isinstance(other, GpmSupport): + return False + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpmSupport_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlGpmSupport_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpmSupport") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpmSupport_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: IN: Set to NVML_GPM_SUPPORT_VERSION.""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This GpmSupport instance is read-only") + self._ptr[0].version = val + + @property + def is_supported_device(self): + """int: OUT: Indicates device support.""" + return self._ptr[0].isSupportedDevice + + @is_supported_device.setter + def is_supported_device(self, val): + if self._readonly: + raise ValueError("This GpmSupport instance is read-only") + self._ptr[0].isSupportedDevice = val + + @staticmethod + def from_data(data): + """Create an GpmSupport instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `gpm_support_dtype` holding the data. + """ + return __from_data(data, "gpm_support_dtype", gpm_support_dtype, GpmSupport.from_ptr) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an GpmSupport 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 GpmSupport obj = GpmSupport.__new__(GpmSupport) + if owner is None: + obj._ptr = malloc(sizeof(nvmlGpmSupport_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating GpmSupport") + memcpy((obj._ptr), ptr, sizeof(nvmlGpmSupport_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +device_capabilities_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("cap_mask", _numpy.uint32, ), + ], align=True) + + +cdef class DeviceCapabilities_v1: + """Empty-initialize an instance of `nvmlDeviceCapabilities_v1_t`. + + + .. seealso:: `nvmlDeviceCapabilities_v1_t` + """ + cdef: + nvmlDeviceCapabilities_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlDeviceCapabilities_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating DeviceCapabilities_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + def __repr__(self): + return f"<{__name__}.DeviceCapabilities_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 DeviceCapabilities_v1 other_ + if not isinstance(other, DeviceCapabilities_v1): + return False + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof(nvmlDeviceCapabilities_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlDeviceCapabilities_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating DeviceCapabilities_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlDeviceCapabilities_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 DeviceCapabilities_v1 instance is read-only") + self._ptr[0].version = val + + @property + def cap_mask(self): + """int: OUT: Bit mask of capabilities.""" + return self._ptr[0].capMask + + @cap_mask.setter + def cap_mask(self, val): + if self._readonly: + raise ValueError("This DeviceCapabilities_v1 instance is read-only") + self._ptr[0].capMask = val + + @staticmethod + def from_data(data): + """Create an DeviceCapabilities_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `device_capabilities_v1_dtype` holding the data. + """ + return __from_data(data, "device_capabilities_v1_dtype", device_capabilities_v1_dtype, DeviceCapabilities_v1.from_ptr) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an DeviceCapabilities_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 DeviceCapabilities_v1 obj = DeviceCapabilities_v1.__new__(DeviceCapabilities_v1) + if owner is None: + obj._ptr = malloc(sizeof(nvmlDeviceCapabilities_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating DeviceCapabilities_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlDeviceCapabilities_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +device_addressing_mode_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("value", _numpy.uint32, ), + ], align=True) + + +cdef class DeviceAddressingMode_v1: + """Empty-initialize an instance of `nvmlDeviceAddressingMode_v1_t`. + + + .. seealso:: `nvmlDeviceAddressingMode_v1_t` + """ + cdef: + nvmlDeviceAddressingMode_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlDeviceAddressingMode_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating DeviceAddressingMode_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlDeviceAddressingMode_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlDeviceAddressingMode_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating DeviceAddressingMode_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlDeviceAddressingMode_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "device_addressing_mode_v1_dtype", device_addressing_mode_v1_dtype, DeviceAddressingMode_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlDeviceAddressingMode_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating DeviceAddressingMode_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlDeviceAddressingMode_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +repair_status_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("b_channel_repair_pending", _numpy.uint32, ), + ("b_tpc_repair_pending", _numpy.uint32, ), + ], align=True) + + +cdef class RepairStatus_v1: + """Empty-initialize an instance of `nvmlRepairStatus_v1_t`. + + + .. seealso:: `nvmlRepairStatus_v1_t` + """ + cdef: + nvmlRepairStatus_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlRepairStatus_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating RepairStatus_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlRepairStatus_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlRepairStatus_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating RepairStatus_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlRepairStatus_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 __from_data(data, "repair_status_v1_dtype", repair_status_v1_dtype, RepairStatus_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlRepairStatus_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating RepairStatus_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlRepairStatus_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +pdi_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("value", _numpy.uint64, ), + ], align=True) + + +cdef class Pdi_v1: + """Empty-initialize an instance of `nvmlPdi_v1_t`. + + + .. seealso:: `nvmlPdi_v1_t` + """ + cdef: + nvmlPdi_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlPdi_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating Pdi_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + def __repr__(self): + return f"<{__name__}.Pdi_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 Pdi_v1 other_ + if not isinstance(other, Pdi_v1): + return False + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof(nvmlPdi_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlPdi_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating Pdi_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPdi_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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 Pdi_v1 instance is read-only") + self._ptr[0].version = val + + @property + def value(self): + """int: 64-bit PDI value""" + return self._ptr[0].value + + @value.setter + def value(self, val): + if self._readonly: + raise ValueError("This Pdi_v1 instance is read-only") + self._ptr[0].value = val + + @staticmethod + def from_data(data): + """Create an Pdi_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `pdi_v1_dtype` holding the data. + """ + return __from_data(data, "pdi_v1_dtype", pdi_v1_dtype, Pdi_v1.from_ptr) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an Pdi_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 Pdi_v1 obj = Pdi_v1.__new__(Pdi_v1) + if owner is None: + obj._ptr = malloc(sizeof(nvmlPdi_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating Pdi_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlPdi_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +device_power_mizer_modes_v1_dtype = _numpy.dtype([ + ("current_mode", _numpy.uint32, ), + ("mode", _numpy.uint32, ), + ("supported_power_mizer_modes", _numpy.uint32, ), + ], align=True) + + +cdef class DevicePowerMizerModes_v1: + """Empty-initialize an instance of `nvmlDevicePowerMizerModes_v1_t`. + + + .. seealso:: `nvmlDevicePowerMizerModes_v1_t` + """ + cdef: + nvmlDevicePowerMizerModes_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlDevicePowerMizerModes_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating DevicePowerMizerModes_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlDevicePowerMizerModes_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlDevicePowerMizerModes_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating DevicePowerMizerModes_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlDevicePowerMizerModes_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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.""" + 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_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 __from_data(data, "device_power_mizer_modes_v1_dtype", device_power_mizer_modes_v1_dtype, DevicePowerMizerModes_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlDevicePowerMizerModes_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating DevicePowerMizerModes_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlDevicePowerMizerModes_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +ecc_sram_unique_uncorrected_error_entry_v1_dtype = _numpy.dtype([ + ("unit", _numpy.uint32, ), + ("location", _numpy.uint32, ), + ("sublocation", _numpy.uint32, ), + ("extlocation", _numpy.uint32, ), + ("address", _numpy.uint32, ), + ("is_parity", _numpy.uint32, ), + ("count", _numpy.uint32, ), + ], align=True) + + +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 + + + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=ecc_sram_unique_uncorrected_error_entry_v1_dtype) + self._data = arr.view(_numpy.recarray) + 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 self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, 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()) + + @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): + 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): + 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): + 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): + 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): + 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): + 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): + self._data.count = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return EccSramUniqueUncorrectedErrorEntry_v1.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == ecc_sram_unique_uncorrected_error_entry_v1_dtype: + return EccSramUniqueUncorrectedErrorEntry_v1.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @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(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """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`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef EccSramUniqueUncorrectedErrorEntry_v1 obj = EccSramUniqueUncorrectedErrorEntry_v1.__new__(EccSramUniqueUncorrectedErrorEntry_v1) + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlEccSramUniqueUncorrectedErrorEntry_v1_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=ecc_sram_unique_uncorrected_error_entry_v1_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +gpu_fabric_info_v3_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("cluster_uuid", _numpy.uint8, (16,)), + ("status", _numpy.int32, ), + ("clique_id", _numpy.uint32, ), + ("state", _numpy.uint8, ), + ("health_mask", _numpy.uint32, ), + ("health_summary", _numpy.uint8, ), + ], align=True) + + +cdef class GpuFabricInfo_v3: + """Empty-initialize an instance of `nvmlGpuFabricInfo_v3_t`. + + + .. seealso:: `nvmlGpuFabricInfo_v3_t` + """ + cdef: + nvmlGpuFabricInfo_v3_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlGpuFabricInfo_v3_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuFabricInfo_v3") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuFabricInfo_v3_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlGpuFabricInfo_v3_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuFabricInfo_v3") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuFabricInfo_v3_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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_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 view.array arr = view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].clusterUuid)) + return arr + + @cluster_uuid.setter + def cluster_uuid(self, val): + if self._readonly: + raise ValueError("This GpuFabricInfo_v3 instance is read-only") + cdef view.array arr = view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) + 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_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 __from_data(data, "gpu_fabric_info_v3_dtype", gpu_fabric_info_v3_dtype, GpuFabricInfo_v3.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlGpuFabricInfo_v3_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating GpuFabricInfo_v3") + memcpy((obj._ptr), ptr, sizeof(nvmlGpuFabricInfo_v3_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +nvlink_firmware_version_dtype = _numpy.dtype([ + ("ucode_type", _numpy.uint8, ), + ("major", _numpy.uint32, ), + ("minor", _numpy.uint32, ), + ("sub_minor", _numpy.uint32, ), + ], align=True) + + +cdef class NvlinkFirmwareVersion: + """Empty-initialize an instance of `nvmlNvlinkFirmwareVersion_t`. + + + .. seealso:: `nvmlNvlinkFirmwareVersion_t` + """ + cdef: + nvmlNvlinkFirmwareVersion_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlNvlinkFirmwareVersion_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvlinkFirmwareVersion") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + def __repr__(self): + 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 (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef NvlinkFirmwareVersion other_ + if not isinstance(other, NvlinkFirmwareVersion): + return False + other_ = other + return (memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvlinkFirmwareVersion_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlNvlinkFirmwareVersion_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvlinkFirmwareVersion") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvlinkFirmwareVersion_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def ucode_type(self): + """int: """ + return self._ptr[0].ucodeType + + @ucode_type.setter + def ucode_type(self, val): + if self._readonly: + raise ValueError("This NvlinkFirmwareVersion instance is read-only") + self._ptr[0].ucodeType = val + + @property + def major(self): + """int: """ + return self._ptr[0].major + + @major.setter + def major(self, val): + if self._readonly: + raise ValueError("This NvlinkFirmwareVersion instance is read-only") + self._ptr[0].major = val + + @property + def minor(self): + """int: """ + return self._ptr[0].minor + + @minor.setter + def minor(self, val): + if self._readonly: + raise ValueError("This NvlinkFirmwareVersion instance is read-only") + self._ptr[0].minor = val + + @property + def sub_minor(self): + """int: """ + return self._ptr[0].subMinor + + @sub_minor.setter + def sub_minor(self, val): + if self._readonly: + raise ValueError("This NvlinkFirmwareVersion instance is read-only") + self._ptr[0].subMinor = val + + @staticmethod + def from_data(data): + """Create an NvlinkFirmwareVersion instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `nvlink_firmware_version_dtype` holding the data. + """ + return __from_data(data, "nvlink_firmware_version_dtype", nvlink_firmware_version_dtype, NvlinkFirmwareVersion.from_ptr) + + @staticmethod + def from_ptr(intptr_t ptr, 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. + 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 NvlinkFirmwareVersion obj = NvlinkFirmwareVersion.__new__(NvlinkFirmwareVersion) + if owner is None: + obj._ptr = malloc(sizeof(nvmlNvlinkFirmwareVersion_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating NvlinkFirmwareVersion") + memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkFirmwareVersion_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +excluded_device_info_dtype = _numpy.dtype([ + ("pci_info", pci_info_dtype, ), + ("uuid", _numpy.int8, (80,)), + ], align=True) + + +cdef class ExcludedDeviceInfo: + """Empty-initialize an instance of `nvmlExcludedDeviceInfo_t`. + + + .. seealso:: `nvmlExcludedDeviceInfo_t` + """ + cdef: + nvmlExcludedDeviceInfo_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlExcludedDeviceInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ExcludedDeviceInfo") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlExcludedDeviceInfo_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlExcludedDeviceInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ExcludedDeviceInfo") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlExcludedDeviceInfo_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def pci_info(self): + """PciInfo: """ + return PciInfo.from_ptr(&(self._ptr[0].pciInfo), self._readonly, self) + + @pci_info.setter + def pci_info(self, val): + if self._readonly: + raise ValueError("This ExcludedDeviceInfo instance is read-only") + cdef PciInfo val_ = val + memcpy(&(self._ptr[0].pciInfo), (val_._get_ptr()), sizeof(nvmlPciInfo_t) * 1) + + @property + def uuid(self): + """~_numpy.int8: (array of length 80).""" + return 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 + memcpy((self._ptr[0].uuid), ptr, 80) + + @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 __from_data(data, "excluded_device_info_dtype", excluded_device_info_dtype, ExcludedDeviceInfo.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlExcludedDeviceInfo_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ExcludedDeviceInfo") + memcpy((obj._ptr), ptr, sizeof(nvmlExcludedDeviceInfo_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +process_detail_list_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("mode", _numpy.uint32, ), + ("num_proc_array_entries", _numpy.uint32, ), + ("proc_array", _numpy.intp, ), + ], align=True) + + +cdef class ProcessDetailList_v1: + """Empty-initialize an instance of `nvmlProcessDetailList_v1_t`. + + + .. seealso:: `nvmlProcessDetailList_v1_t` + """ + cdef: + nvmlProcessDetailList_v1_t *_ptr + object _owner + bint _readonly + dict _refs + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlProcessDetailList_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ProcessDetailList_v1") + self._owner = None + self._readonly = False + self._refs = {} + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlProcessDetailList_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlProcessDetailList_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ProcessDetailList_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlProcessDetailList_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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(Compute/Graphics/MPSCompute)""" + 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) + + @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_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 __from_data(data, "process_detail_list_v1_dtype", process_detail_list_v1_dtype, ProcessDetailList_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlProcessDetailList_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ProcessDetailList_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlProcessDetailList_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + obj._refs = {} + return obj + + +bridge_chip_hierarchy_dtype = _numpy.dtype([ + ("bridge_count", _numpy.uint8, ), + ("bridge_chip_info", bridge_chip_info_dtype, (128,)), + ], align=True) + + +cdef class BridgeChipHierarchy: + """Empty-initialize an instance of `nvmlBridgeChipHierarchy_t`. + + + .. seealso:: `nvmlBridgeChipHierarchy_t` + """ + cdef: + nvmlBridgeChipHierarchy_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlBridgeChipHierarchy_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating BridgeChipHierarchy") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlBridgeChipHierarchy_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlBridgeChipHierarchy_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating BridgeChipHierarchy") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlBridgeChipHierarchy_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def bridge_chip_info(self): + """BridgeChipInfo: """ + return BridgeChipInfo.from_ptr(&(self._ptr[0].bridgeChipInfo), 128, self._readonly) + + @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)}") + memcpy(&(self._ptr[0].bridgeChipInfo), (val_._get_ptr()), sizeof(nvmlBridgeChipInfo_t) * 128) + + @property + def bridge_count(self): + """int: """ + return self._ptr[0].bridgeCount + + @bridge_count.setter + def bridge_count(self, val): + if self._readonly: + raise ValueError("This BridgeChipHierarchy instance is read-only") + self._ptr[0].bridgeCount = val + + @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 __from_data(data, "bridge_chip_hierarchy_dtype", bridge_chip_hierarchy_dtype, BridgeChipHierarchy.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlBridgeChipHierarchy_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating BridgeChipHierarchy") + memcpy((obj._ptr), ptr, sizeof(nvmlBridgeChipHierarchy_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +sample_dtype = _numpy.dtype([ + ("time_stamp", _numpy.uint64, ), + ("sample_value", value_dtype, ), + ], align=True) + + +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 + + readonly tuple _sample_value + + + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=sample_dtype) + self._data = arr.view(_numpy.recarray) + 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 self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, Sample)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + @property + def sample_value(self): + """Value: """ + if self._data.size == 1: + return self._sample_value[0] + return self._sample_value + + @property + def time_stamp(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.time_stamp[0]) + return self._data.time_stamp + + @time_stamp.setter + def time_stamp(self, val): + self._data.time_stamp = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return Sample.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == sample_dtype: + return Sample.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @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(_numpy.recarray) + + sample_value_list = list() + for i in range(obj._data.size): + addr = obj._data.sample_value[i].__array_interface__['data'][0] + Value_obj = Value.from_ptr(addr, owner=obj) + sample_value_list.append(Value_obj) + + obj._sample_value = tuple(sample_value_list) + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """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`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef Sample obj = Sample.__new__(Sample) + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlSample_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=sample_dtype) + obj._data = data.view(_numpy.recarray) + + sample_value_list = list() + for i in range(obj._data.size): + addr = obj._data.sample_value[i].__array_interface__['data'][0] + Value_obj = Value.from_ptr(addr, owner=obj) + sample_value_list.append(Value_obj) + + obj._sample_value = tuple(sample_value_list) + return obj + + +vgpu_instance_utilization_info_v1_dtype = _numpy.dtype([ + ("time_stamp", _numpy.uint64, ), + ("vgpu_instance", _numpy.uint32, ), + ("sm_util", value_dtype, ), + ("mem_util", value_dtype, ), + ("enc_util", value_dtype, ), + ("dec_util", value_dtype, ), + ("jpg_util", value_dtype, ), + ("ofa_util", value_dtype, ), + ], align=True) + + +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 + + readonly tuple _sm_util + + readonly tuple _mem_util + + readonly tuple _enc_util + + readonly tuple _dec_util + + readonly tuple _jpg_util + + readonly tuple _ofa_util + + + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=vgpu_instance_utilization_info_v1_dtype) + self._data = arr.view(_numpy.recarray) + 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 self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, 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()) + + @property + def sm_util(self): + """Value: SM (3D/Compute) Util Value.""" + if self._data.size == 1: + return self._sm_util[0] + return self._sm_util + + @property + def mem_util(self): + """Value: Frame Buffer Memory Util Value.""" + if self._data.size == 1: + return self._mem_util[0] + return self._mem_util + + @property + def enc_util(self): + """Value: Encoder Util Value.""" + if self._data.size == 1: + return self._enc_util[0] + return self._enc_util + + @property + def dec_util(self): + """Value: Decoder Util Value.""" + if self._data.size == 1: + return self._dec_util[0] + return self._dec_util + + @property + def jpg_util(self): + """Value: Jpeg Util Value.""" + if self._data.size == 1: + return self._jpg_util[0] + return self._jpg_util + + @property + def ofa_util(self): + """Value: Ofa Util Value.""" + if self._data.size == 1: + return self._ofa_util[0] + return self._ofa_util + + @property + def time_stamp(self): + """Union[~_numpy.uint64, int]: CPU Timestamp in microseconds.""" + if self._data.size == 1: + return int(self._data.time_stamp[0]) + return self._data.time_stamp + + @time_stamp.setter + def time_stamp(self, val): + self._data.time_stamp = val + + @property + def vgpu_instance(self): + """Union[~_numpy.uint32, int]: vGPU Instance""" + if self._data.size == 1: + return int(self._data.vgpu_instance[0]) + return self._data.vgpu_instance + + @vgpu_instance.setter + def vgpu_instance(self, val): + self._data.vgpu_instance = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return VgpuInstanceUtilizationInfo_v1.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == vgpu_instance_utilization_info_v1_dtype: + return VgpuInstanceUtilizationInfo_v1.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @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(_numpy.recarray) + + sm_util_list = list() + for i in range(obj._data.size): + addr = obj._data.sm_util[i].__array_interface__['data'][0] + Value_obj = Value.from_ptr(addr, owner=obj) + sm_util_list.append(Value_obj) + + obj._sm_util = tuple(sm_util_list) + mem_util_list = list() + for i in range(obj._data.size): + addr = obj._data.mem_util[i].__array_interface__['data'][0] + Value_obj = Value.from_ptr(addr, owner=obj) + mem_util_list.append(Value_obj) + + obj._mem_util = tuple(mem_util_list) + enc_util_list = list() + for i in range(obj._data.size): + addr = obj._data.enc_util[i].__array_interface__['data'][0] + Value_obj = Value.from_ptr(addr, owner=obj) + enc_util_list.append(Value_obj) + + obj._enc_util = tuple(enc_util_list) + dec_util_list = list() + for i in range(obj._data.size): + addr = obj._data.dec_util[i].__array_interface__['data'][0] + Value_obj = Value.from_ptr(addr, owner=obj) + dec_util_list.append(Value_obj) + + obj._dec_util = tuple(dec_util_list) + jpg_util_list = list() + for i in range(obj._data.size): + addr = obj._data.jpg_util[i].__array_interface__['data'][0] + Value_obj = Value.from_ptr(addr, owner=obj) + jpg_util_list.append(Value_obj) + + obj._jpg_util = tuple(jpg_util_list) + ofa_util_list = list() + for i in range(obj._data.size): + addr = obj._data.ofa_util[i].__array_interface__['data'][0] + Value_obj = Value.from_ptr(addr, owner=obj) + ofa_util_list.append(Value_obj) + + obj._ofa_util = tuple(ofa_util_list) + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """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`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuInstanceUtilizationInfo_v1 obj = VgpuInstanceUtilizationInfo_v1.__new__(VgpuInstanceUtilizationInfo_v1) + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlVgpuInstanceUtilizationInfo_v1_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=vgpu_instance_utilization_info_v1_dtype) + obj._data = data.view(_numpy.recarray) + + sm_util_list = list() + for i in range(obj._data.size): + addr = obj._data.sm_util[i].__array_interface__['data'][0] + Value_obj = Value.from_ptr(addr, owner=obj) + sm_util_list.append(Value_obj) + + obj._sm_util = tuple(sm_util_list) + mem_util_list = list() + for i in range(obj._data.size): + addr = obj._data.mem_util[i].__array_interface__['data'][0] + Value_obj = Value.from_ptr(addr, owner=obj) + mem_util_list.append(Value_obj) + + obj._mem_util = tuple(mem_util_list) + enc_util_list = list() + for i in range(obj._data.size): + addr = obj._data.enc_util[i].__array_interface__['data'][0] + Value_obj = Value.from_ptr(addr, owner=obj) + enc_util_list.append(Value_obj) + + obj._enc_util = tuple(enc_util_list) + dec_util_list = list() + for i in range(obj._data.size): + addr = obj._data.dec_util[i].__array_interface__['data'][0] + Value_obj = Value.from_ptr(addr, owner=obj) + dec_util_list.append(Value_obj) + + obj._dec_util = tuple(dec_util_list) + jpg_util_list = list() + for i in range(obj._data.size): + addr = obj._data.jpg_util[i].__array_interface__['data'][0] + Value_obj = Value.from_ptr(addr, owner=obj) + jpg_util_list.append(Value_obj) + + obj._jpg_util = tuple(jpg_util_list) + ofa_util_list = list() + for i in range(obj._data.size): + addr = obj._data.ofa_util[i].__array_interface__['data'][0] + Value_obj = Value.from_ptr(addr, owner=obj) + ofa_util_list.append(Value_obj) + + obj._ofa_util = tuple(ofa_util_list) + return obj + + +field_value_dtype = _numpy.dtype([ + ("field_id", _numpy.uint32, ), + ("scope_id", _numpy.uint32, ), + ("timestamp", _numpy.int64, ), + ("latency_usec", _numpy.int64, ), + ("value_type", _numpy.int32, ), + ("nvml_return", _numpy.int32, ), + ("value", value_dtype, ), + ], align=True) + + +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 + + readonly tuple _value + + + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=field_value_dtype) + self._data = arr.view(_numpy.recarray) + 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 self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, FieldValue)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + @property + def value(self): + """Value: """ + if self._data.size == 1: + return self._value[0] + return self._value + + @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): + 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): + 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): + 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): + 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): + 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): + self._data.nvml_return = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return FieldValue.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == field_value_dtype: + return FieldValue.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @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(_numpy.recarray) + + value_list = list() + for i in range(obj._data.size): + addr = obj._data.value[i].__array_interface__['data'][0] + Value_obj = Value.from_ptr(addr, owner=obj) + value_list.append(Value_obj) + + obj._value = tuple(value_list) + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """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`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef FieldValue obj = FieldValue.__new__(FieldValue) + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlFieldValue_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=field_value_dtype) + obj._data = data.view(_numpy.recarray) + + value_list = list() + for i in range(obj._data.size): + addr = obj._data.value[i].__array_interface__['data'][0] + Value_obj = Value.from_ptr(addr, owner=obj) + value_list.append(Value_obj) + + obj._value = tuple(value_list) + return obj + + +gpu_thermal_settings_dtype = _numpy.dtype([ + ("count", _numpy.uint32, ), + ("sensor", _py_anon_pod0_dtype, (3,)), + ], align=True) + + +cdef class GpuThermalSettings: + """Empty-initialize an instance of `nvmlGpuThermalSettings_t`. + + + .. seealso:: `nvmlGpuThermalSettings_t` + """ + cdef: + nvmlGpuThermalSettings_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlGpuThermalSettings_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuThermalSettings") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuThermalSettings_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlGpuThermalSettings_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuThermalSettings") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuThermalSettings_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def sensor(self): + """_py_anon_pod0: """ + return _py_anon_pod0.from_ptr(&(self._ptr[0].sensor), 3, self._readonly) + + @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)}") + memcpy(&(self._ptr[0].sensor), (val_._get_ptr()), sizeof(_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_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 __from_data(data, "gpu_thermal_settings_dtype", gpu_thermal_settings_dtype, GpuThermalSettings.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlGpuThermalSettings_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating GpuThermalSettings") + memcpy((obj._ptr), ptr, sizeof(nvmlGpuThermalSettings_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +clk_mon_status_dtype = _numpy.dtype([ + ("b_global_status", _numpy.uint32, ), + ("clk_mon_list_size", _numpy.uint32, ), + ("clk_mon_list", clk_mon_fault_info_dtype, (32,)), + ], align=True) + + +cdef class ClkMonStatus: + """Empty-initialize an instance of `nvmlClkMonStatus_t`. + + + .. seealso:: `nvmlClkMonStatus_t` + """ + cdef: + nvmlClkMonStatus_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlClkMonStatus_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ClkMonStatus") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlClkMonStatus_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlClkMonStatus_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ClkMonStatus") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlClkMonStatus_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def clk_mon_list(self): + """ClkMonFaultInfo: """ + return ClkMonFaultInfo.from_ptr(&(self._ptr[0].clkMonList), 32, self._readonly) + + @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)}") + memcpy(&(self._ptr[0].clkMonList), (val_._get_ptr()), sizeof(nvmlClkMonFaultInfo_t) * 32) + + @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 + + @property + def clk_mon_list_size(self): + """int: """ + return self._ptr[0].clkMonListSize + + @clk_mon_list_size.setter + def clk_mon_list_size(self, val): + if self._readonly: + raise ValueError("This ClkMonStatus instance is read-only") + self._ptr[0].clkMonListSize = val + + @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 __from_data(data, "clk_mon_status_dtype", clk_mon_status_dtype, ClkMonStatus.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlClkMonStatus_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ClkMonStatus") + memcpy((obj._ptr), ptr, sizeof(nvmlClkMonStatus_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +processes_utilization_info_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("process_samples_count", _numpy.uint32, ), + ("last_seen_time_stamp", _numpy.uint64, ), + ("proc_util_array", _numpy.intp, ), + ], align=True) + + +cdef class ProcessesUtilizationInfo_v1: + """Empty-initialize an instance of `nvmlProcessesUtilizationInfo_v1_t`. + + + .. seealso:: `nvmlProcessesUtilizationInfo_v1_t` + """ + cdef: + nvmlProcessesUtilizationInfo_v1_t *_ptr + object _owner + bint _readonly + dict _refs + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlProcessesUtilizationInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ProcessesUtilizationInfo_v1") + self._owner = None + self._readonly = False + self._refs = {} + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlProcessesUtilizationInfo_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlProcessesUtilizationInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ProcessesUtilizationInfo_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlProcessesUtilizationInfo_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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) + + @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_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 __from_data(data, "processes_utilization_info_v1_dtype", processes_utilization_info_v1_dtype, ProcessesUtilizationInfo_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlProcessesUtilizationInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ProcessesUtilizationInfo_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlProcessesUtilizationInfo_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + obj._refs = {} + return obj + + +gpu_dynamic_pstates_info_dtype = _numpy.dtype([ + ("flags_", _numpy.uint32, ), + ("utilization", _py_anon_pod1_dtype, (8,)), + ], align=True) + + +cdef class GpuDynamicPstatesInfo: + """Empty-initialize an instance of `nvmlGpuDynamicPstatesInfo_t`. + + + .. seealso:: `nvmlGpuDynamicPstatesInfo_t` + """ + cdef: + nvmlGpuDynamicPstatesInfo_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlGpuDynamicPstatesInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuDynamicPstatesInfo") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuDynamicPstatesInfo_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlGpuDynamicPstatesInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuDynamicPstatesInfo") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuDynamicPstatesInfo_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def utilization(self): + """_py_anon_pod1: """ + return _py_anon_pod1.from_ptr(&(self._ptr[0].utilization), 8, self._readonly) + + @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)}") + memcpy(&(self._ptr[0].utilization), (val_._get_ptr()), sizeof(_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_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 __from_data(data, "gpu_dynamic_pstates_info_dtype", gpu_dynamic_pstates_info_dtype, GpuDynamicPstatesInfo.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlGpuDynamicPstatesInfo_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating GpuDynamicPstatesInfo") + memcpy((obj._ptr), ptr, sizeof(nvmlGpuDynamicPstatesInfo_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +vgpu_processes_utilization_info_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("vgpu_process_count", _numpy.uint32, ), + ("last_seen_time_stamp", _numpy.uint64, ), + ("vgpu_proc_util_array", _numpy.intp, ), + ], align=True) + + +cdef class VgpuProcessesUtilizationInfo_v1: + """Empty-initialize an instance of `nvmlVgpuProcessesUtilizationInfo_v1_t`. + + + .. seealso:: `nvmlVgpuProcessesUtilizationInfo_v1_t` + """ + cdef: + nvmlVgpuProcessesUtilizationInfo_v1_t *_ptr + object _owner + bint _readonly + dict _refs + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuProcessesUtilizationInfo_v1") + self._owner = None + self._readonly = False + self._refs = {} + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuProcessesUtilizationInfo_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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) + + @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_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 __from_data(data, "vgpu_processes_utilization_info_v1_dtype", vgpu_processes_utilization_info_v1_dtype, VgpuProcessesUtilizationInfo_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuProcessesUtilizationInfo_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + obj._refs = {} + return obj + + +vgpu_scheduler_params_dtype = _numpy.dtype(( + _numpy.dtype((_numpy.void, sizeof(nvmlVgpuSchedulerParams_t))), + { + "vgpu_sched_data_with_arr": (_py_anon_pod2_dtype, 0), + "vgpu_sched_data": (_py_anon_pod3_dtype, 0), + } + )) + + +cdef class VgpuSchedulerParams: + """Empty-initialize an instance of `nvmlVgpuSchedulerParams_t`. + + + .. seealso:: `nvmlVgpuSchedulerParams_t` + """ + cdef: + nvmlVgpuSchedulerParams_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuSchedulerParams_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerParams") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerParams_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuSchedulerParams_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerParams") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerParams_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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), self._readonly, 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 + memcpy(&(self._ptr[0].vgpuSchedDataWithARR), (val_._get_ptr()), sizeof(_anon_pod2) * 1) + + @property + def vgpu_sched_data(self): + """_py_anon_pod3: """ + return _py_anon_pod3.from_ptr(&(self._ptr[0].vgpuSchedData), self._readonly, 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 + memcpy(&(self._ptr[0].vgpuSchedData), (val_._get_ptr()), sizeof(_anon_pod3) * 1) + + @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 __from_data(data, "vgpu_scheduler_params_dtype", vgpu_scheduler_params_dtype, VgpuSchedulerParams.from_ptr) + + @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 = malloc(sizeof(nvmlVgpuSchedulerParams_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerParams") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerParams_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +vgpu_scheduler_set_params_dtype = _numpy.dtype(( + _numpy.dtype((_numpy.void, sizeof(nvmlVgpuSchedulerSetParams_t))), + { + "vgpu_sched_data_with_arr": (_py_anon_pod4_dtype, 0), + "vgpu_sched_data": (_py_anon_pod5_dtype, 0), + } + )) + + +cdef class VgpuSchedulerSetParams: + """Empty-initialize an instance of `nvmlVgpuSchedulerSetParams_t`. + + + .. seealso:: `nvmlVgpuSchedulerSetParams_t` + """ + cdef: + nvmlVgpuSchedulerSetParams_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuSchedulerSetParams_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerSetParams") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerSetParams_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuSchedulerSetParams_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerSetParams") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerSetParams_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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), self._readonly, 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 + memcpy(&(self._ptr[0].vgpuSchedDataWithARR), (val_._get_ptr()), sizeof(_anon_pod4) * 1) + + @property + def vgpu_sched_data(self): + """_py_anon_pod5: """ + return _py_anon_pod5.from_ptr(&(self._ptr[0].vgpuSchedData), self._readonly, 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 + memcpy(&(self._ptr[0].vgpuSchedData), (val_._get_ptr()), sizeof(_anon_pod5) * 1) + + @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 __from_data(data, "vgpu_scheduler_set_params_dtype", vgpu_scheduler_set_params_dtype, VgpuSchedulerSetParams.from_ptr) + + @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 = malloc(sizeof(nvmlVgpuSchedulerSetParams_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerSetParams") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerSetParams_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +vgpu_license_info_dtype = _numpy.dtype([ + ("is_licensed", _numpy.uint8, ), + ("license_expiry", vgpu_license_expiry_dtype, ), + ("current_state", _numpy.uint32, ), + ], align=True) + + +cdef class VgpuLicenseInfo: + """Empty-initialize an instance of `nvmlVgpuLicenseInfo_t`. + + + .. seealso:: `nvmlVgpuLicenseInfo_t` + """ + cdef: + nvmlVgpuLicenseInfo_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuLicenseInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuLicenseInfo") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuLicenseInfo_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuLicenseInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuLicenseInfo") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuLicenseInfo_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def license_expiry(self): + """VgpuLicenseExpiry: """ + return VgpuLicenseExpiry.from_ptr(&(self._ptr[0].licenseExpiry), self._readonly, self) + + @license_expiry.setter + def license_expiry(self, val): + if self._readonly: + raise ValueError("This VgpuLicenseInfo instance is read-only") + cdef VgpuLicenseExpiry val_ = val + 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_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 __from_data(data, "vgpu_license_info_dtype", vgpu_license_info_dtype, VgpuLicenseInfo.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlVgpuLicenseInfo_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuLicenseInfo") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuLicenseInfo_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +grid_licensable_feature_dtype = _numpy.dtype([ + ("feature_code", _numpy.int32, ), + ("feature_state", _numpy.uint32, ), + ("license_info", _numpy.int8, (128,)), + ("product_name", _numpy.int8, (128,)), + ("feature_enabled", _numpy.uint32, ), + ("license_expiry", grid_license_expiry_dtype, ), + ], align=True) + + +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 + + readonly tuple _license_expiry + + + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=grid_licensable_feature_dtype) + self._data = arr.view(_numpy.recarray) + 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 self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, GridLicensableFeature)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + @property + def license_expiry(self): + """GridLicenseExpiry: """ + if self._data.size == 1: + return self._license_expiry[0] + return self._license_expiry + + @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): + 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): + 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): + 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): + 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): + self._data.feature_enabled = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return GridLicensableFeature.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == grid_licensable_feature_dtype: + return GridLicensableFeature.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @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(_numpy.recarray) + + license_expiry_list = list() + for i in range(obj._data.size): + addr = obj._data.license_expiry[i].__array_interface__['data'][0] + GridLicenseExpiry_obj = GridLicenseExpiry.from_ptr(addr, owner=obj) + license_expiry_list.append(GridLicenseExpiry_obj) + + obj._license_expiry = tuple(license_expiry_list) + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """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`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef GridLicensableFeature obj = GridLicensableFeature.__new__(GridLicensableFeature) + cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE + cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlGridLicensableFeature_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=grid_licensable_feature_dtype) + obj._data = data.view(_numpy.recarray) + + license_expiry_list = list() + for i in range(obj._data.size): + addr = obj._data.license_expiry[i].__array_interface__['data'][0] + GridLicenseExpiry_obj = GridLicenseExpiry.from_ptr(addr, owner=obj) + license_expiry_list.append(GridLicenseExpiry_obj) + + obj._license_expiry = tuple(license_expiry_list) + return obj + + +unit_fan_speeds_dtype = _numpy.dtype([ + ("fans", unit_fan_info_dtype, (24,)), + ("count", _numpy.uint32, ), + ], align=True) + + +cdef class UnitFanSpeeds: + """Empty-initialize an instance of `nvmlUnitFanSpeeds_t`. + + + .. seealso:: `nvmlUnitFanSpeeds_t` + """ + cdef: + nvmlUnitFanSpeeds_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlUnitFanSpeeds_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating UnitFanSpeeds") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlUnitFanSpeeds_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlUnitFanSpeeds_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating UnitFanSpeeds") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlUnitFanSpeeds_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def fans(self): + """UnitFanInfo: """ + return UnitFanInfo.from_ptr(&(self._ptr[0].fans), 24, self._readonly) + + @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)}") + 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_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 __from_data(data, "unit_fan_speeds_dtype", unit_fan_speeds_dtype, UnitFanSpeeds.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlUnitFanSpeeds_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating UnitFanSpeeds") + memcpy((obj._ptr), ptr, sizeof(nvmlUnitFanSpeeds_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +vgpu_pgpu_metadata_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("revision", _numpy.uint32, ), + ("host_driver_version", _numpy.int8, (80,)), + ("pgpu_virtualization_caps", _numpy.uint32, ), + ("reserved", _numpy.uint32, (5,)), + ("host_supported_vgpu_range", vgpu_version_dtype, ), + ("opaque_data_size", _numpy.uint32, ), + ("opaque_data", _numpy.int8, (4,)), + ], align=True) + + +cdef class VgpuPgpuMetadata: + """Empty-initialize an instance of `nvmlVgpuPgpuMetadata_t`. + + + .. seealso:: `nvmlVgpuPgpuMetadata_t` + """ + cdef: + nvmlVgpuPgpuMetadata_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuPgpuMetadata_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuPgpuMetadata") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuPgpuMetadata_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuPgpuMetadata_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuPgpuMetadata") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuPgpuMetadata_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def host_supported_vgpu_range(self): + """VgpuVersion: """ + return VgpuVersion.from_ptr(&(self._ptr[0].hostSupportedVgpuRange), self._readonly, 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 + 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 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 + 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 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 + memcpy((self._ptr[0].opaqueData), ptr, 4) + + @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 __from_data(data, "vgpu_pgpu_metadata_dtype", vgpu_pgpu_metadata_dtype, VgpuPgpuMetadata.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlVgpuPgpuMetadata_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuPgpuMetadata") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuPgpuMetadata_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +gpu_instance_info_dtype = _numpy.dtype([ + ("device_", _numpy.intp, ), + ("id", _numpy.uint32, ), + ("profile_id", _numpy.uint32, ), + ("placement", gpu_instance_placement_dtype, ), + ], align=True) + + +cdef class GpuInstanceInfo: + """Empty-initialize an instance of `nvmlGpuInstanceInfo_t`. + + + .. seealso:: `nvmlGpuInstanceInfo_t` + """ + cdef: + nvmlGpuInstanceInfo_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlGpuInstanceInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuInstanceInfo") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuInstanceInfo_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlGpuInstanceInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuInstanceInfo") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuInstanceInfo_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def placement(self): + """GpuInstancePlacement: """ + return GpuInstancePlacement.from_ptr(&(self._ptr[0].placement), self._readonly, self) + + @placement.setter + def placement(self, val): + if self._readonly: + raise ValueError("This GpuInstanceInfo instance is read-only") + cdef GpuInstancePlacement val_ = val + 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_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 __from_data(data, "gpu_instance_info_dtype", gpu_instance_info_dtype, GpuInstanceInfo.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlGpuInstanceInfo_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating GpuInstanceInfo") + memcpy((obj._ptr), ptr, sizeof(nvmlGpuInstanceInfo_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +compute_instance_info_dtype = _numpy.dtype([ + ("device_", _numpy.intp, ), + ("gpu_instance", _numpy.intp, ), + ("id", _numpy.uint32, ), + ("profile_id", _numpy.uint32, ), + ("placement", compute_instance_placement_dtype, ), + ], align=True) + + +cdef class ComputeInstanceInfo: + """Empty-initialize an instance of `nvmlComputeInstanceInfo_t`. + + + .. seealso:: `nvmlComputeInstanceInfo_t` + """ + cdef: + nvmlComputeInstanceInfo_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlComputeInstanceInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ComputeInstanceInfo") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlComputeInstanceInfo_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlComputeInstanceInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ComputeInstanceInfo") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlComputeInstanceInfo_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def placement(self): + """ComputeInstancePlacement: """ + return ComputeInstancePlacement.from_ptr(&(self._ptr[0].placement), self._readonly, self) + + @placement.setter + def placement(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceInfo instance is read-only") + cdef ComputeInstancePlacement val_ = val + 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_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 __from_data(data, "compute_instance_info_dtype", compute_instance_info_dtype, ComputeInstanceInfo.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlComputeInstanceInfo_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ComputeInstanceInfo") + memcpy((obj._ptr), ptr, sizeof(nvmlComputeInstanceInfo_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +ecc_sram_unique_uncorrected_error_counts_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("entry_count", _numpy.uint32, ), + ("entries", _numpy.intp, ), + ], align=True) + + +cdef class EccSramUniqueUncorrectedErrorCounts_v1: + """Empty-initialize an instance of `nvmlEccSramUniqueUncorrectedErrorCounts_v1_t`. + + + .. seealso:: `nvmlEccSramUniqueUncorrectedErrorCounts_v1_t` + """ + cdef: + nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *_ptr + object _owner + bint _readonly + dict _refs + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating EccSramUniqueUncorrectedErrorCounts_v1") + self._owner = None + self._readonly = False + self._refs = {} + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating EccSramUniqueUncorrectedErrorCounts_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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) + + @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_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 __from_data(data, "ecc_sram_unique_uncorrected_error_counts_v1_dtype", ecc_sram_unique_uncorrected_error_counts_v1_dtype, EccSramUniqueUncorrectedErrorCounts_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating EccSramUniqueUncorrectedErrorCounts_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + obj._refs = {} + return obj + + +nvlink_firmware_info_dtype = _numpy.dtype([ + ("firmware_version", nvlink_firmware_version_dtype, (100,)), + ("num_valid_entries", _numpy.uint32, ), + ], align=True) + + +cdef class NvlinkFirmwareInfo: + """Empty-initialize an instance of `nvmlNvlinkFirmwareInfo_t`. + + + .. seealso:: `nvmlNvlinkFirmwareInfo_t` + """ + cdef: + nvmlNvlinkFirmwareInfo_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlNvlinkFirmwareInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvlinkFirmwareInfo") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvlinkFirmwareInfo_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlNvlinkFirmwareInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvlinkFirmwareInfo") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvlinkFirmwareInfo_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def firmware_version(self): + """NvlinkFirmwareVersion: OUT - NVLINK firmware version.""" + return NvlinkFirmwareVersion.from_ptr(&(self._ptr[0].firmwareVersion), 100, self._readonly) + + @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)}") + memcpy(&(self._ptr[0].firmwareVersion), (val_._get_ptr()), sizeof(nvmlNvlinkFirmwareVersion_t) * 100) + + @property + def num_valid_entries(self): + """int: OUT - Number of valid firmware entries.""" + return self._ptr[0].numValidEntries + + @num_valid_entries.setter + def num_valid_entries(self, val): + if self._readonly: + raise ValueError("This NvlinkFirmwareInfo instance is read-only") + self._ptr[0].numValidEntries = val + + @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 __from_data(data, "nvlink_firmware_info_dtype", nvlink_firmware_info_dtype, NvlinkFirmwareInfo.from_ptr) + + @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 = malloc(sizeof(nvmlNvlinkFirmwareInfo_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating NvlinkFirmwareInfo") + memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkFirmwareInfo_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +vgpu_instances_utilization_info_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("sample_val_type", _numpy.int32, ), + ("vgpu_instance_count", _numpy.uint32, ), + ("last_seen_time_stamp", _numpy.uint64, ), + ("vgpu_util_array", _numpy.intp, ), + ], align=True) + + +cdef class VgpuInstancesUtilizationInfo_v1: + """Empty-initialize an instance of `nvmlVgpuInstancesUtilizationInfo_v1_t`. + + + .. seealso:: `nvmlVgpuInstancesUtilizationInfo_v1_t` + """ + cdef: + nvmlVgpuInstancesUtilizationInfo_v1_t *_ptr + object _owner + bint _readonly + dict _refs + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuInstancesUtilizationInfo_v1") + self._owner = None + self._readonly = False + self._refs = {} + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuInstancesUtilizationInfo_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + 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) + + @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_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 __from_data(data, "vgpu_instances_utilization_info_v1_dtype", vgpu_instances_utilization_info_v1_dtype, VgpuInstancesUtilizationInfo_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuInstancesUtilizationInfo_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + obj._refs = {} + return obj + + +vgpu_scheduler_log_dtype = _numpy.dtype([ + ("engine_id", _numpy.uint32, ), + ("scheduler_policy", _numpy.uint32, ), + ("arr_mode", _numpy.uint32, ), + ("scheduler_params", vgpu_scheduler_params_dtype, ), + ("entries_count", _numpy.uint32, ), + ("log_entries", vgpu_scheduler_log_entry_dtype, (200,)), + ], align=True) + + +cdef class VgpuSchedulerLog: + """Empty-initialize an instance of `nvmlVgpuSchedulerLog_t`. + + + .. seealso:: `nvmlVgpuSchedulerLog_t` + """ + cdef: + nvmlVgpuSchedulerLog_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuSchedulerLog_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerLog") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerLog_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuSchedulerLog_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerLog") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerLog_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def scheduler_params(self): + """VgpuSchedulerParams: """ + return VgpuSchedulerParams.from_ptr(&(self._ptr[0].schedulerParams), self._readonly, self) + + @scheduler_params.setter + def scheduler_params(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerLog instance is read-only") + cdef VgpuSchedulerParams val_ = val + 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, self._readonly) + + @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)}") + 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_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 __from_data(data, "vgpu_scheduler_log_dtype", vgpu_scheduler_log_dtype, VgpuSchedulerLog.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlVgpuSchedulerLog_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerLog") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerLog_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +vgpu_scheduler_get_state_dtype = _numpy.dtype([ + ("scheduler_policy", _numpy.uint32, ), + ("arr_mode", _numpy.uint32, ), + ("scheduler_params", vgpu_scheduler_params_dtype, ), + ], align=True) + + +cdef class VgpuSchedulerGetState: + """Empty-initialize an instance of `nvmlVgpuSchedulerGetState_t`. + + + .. seealso:: `nvmlVgpuSchedulerGetState_t` + """ + cdef: + nvmlVgpuSchedulerGetState_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuSchedulerGetState_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerGetState") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerGetState_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuSchedulerGetState_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerGetState") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerGetState_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def scheduler_params(self): + """VgpuSchedulerParams: """ + return VgpuSchedulerParams.from_ptr(&(self._ptr[0].schedulerParams), self._readonly, self) + + @scheduler_params.setter + def scheduler_params(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerGetState instance is read-only") + cdef VgpuSchedulerParams val_ = val + 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_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 __from_data(data, "vgpu_scheduler_get_state_dtype", vgpu_scheduler_get_state_dtype, VgpuSchedulerGetState.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlVgpuSchedulerGetState_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerGetState") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerGetState_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +vgpu_scheduler_state_info_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("engine_id", _numpy.uint32, ), + ("scheduler_policy", _numpy.uint32, ), + ("arr_mode", _numpy.uint32, ), + ("scheduler_params", vgpu_scheduler_params_dtype, ), + ], align=True) + + +cdef class VgpuSchedulerStateInfo_v1: + """Empty-initialize an instance of `nvmlVgpuSchedulerStateInfo_v1_t`. + + + .. seealso:: `nvmlVgpuSchedulerStateInfo_v1_t` + """ + cdef: + nvmlVgpuSchedulerStateInfo_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerStateInfo_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerStateInfo_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def scheduler_params(self): + """VgpuSchedulerParams: OUT: vGPU Scheduler Parameters.""" + return VgpuSchedulerParams.from_ptr(&(self._ptr[0].schedulerParams), self._readonly, 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 + 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_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 __from_data(data, "vgpu_scheduler_state_info_v1_dtype", vgpu_scheduler_state_info_v1_dtype, VgpuSchedulerStateInfo_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerStateInfo_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +vgpu_scheduler_log_info_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("engine_id", _numpy.uint32, ), + ("scheduler_policy", _numpy.uint32, ), + ("arr_mode", _numpy.uint32, ), + ("scheduler_params", vgpu_scheduler_params_dtype, ), + ("entries_count", _numpy.uint32, ), + ("log_entries", vgpu_scheduler_log_entry_dtype, (200,)), + ], align=True) + + +cdef class VgpuSchedulerLogInfo_v1: + """Empty-initialize an instance of `nvmlVgpuSchedulerLogInfo_v1_t`. + + + .. seealso:: `nvmlVgpuSchedulerLogInfo_v1_t` + """ + cdef: + nvmlVgpuSchedulerLogInfo_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerLogInfo_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerLogInfo_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def scheduler_params(self): + """VgpuSchedulerParams: OUT: vGPU Scheduler Parameters.""" + return VgpuSchedulerParams.from_ptr(&(self._ptr[0].schedulerParams), self._readonly, 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 + 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, self._readonly) + + @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)}") + 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_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 __from_data(data, "vgpu_scheduler_log_info_v1_dtype", vgpu_scheduler_log_info_v1_dtype, VgpuSchedulerLogInfo_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerLogInfo_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +vgpu_scheduler_state_v1_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("engine_id", _numpy.uint32, ), + ("scheduler_policy", _numpy.uint32, ), + ("enable_arr_mode", _numpy.uint32, ), + ("scheduler_params", vgpu_scheduler_set_params_dtype, ), + ], align=True) + + +cdef class VgpuSchedulerState_v1: + """Empty-initialize an instance of `nvmlVgpuSchedulerState_v1_t`. + + + .. seealso:: `nvmlVgpuSchedulerState_v1_t` + """ + cdef: + nvmlVgpuSchedulerState_v1_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlVgpuSchedulerState_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerState_v1") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerState_v1_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlVgpuSchedulerState_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerState_v1") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerState_v1_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def scheduler_params(self): + """VgpuSchedulerSetParams: IN: vGPU Scheduler Parameters.""" + return VgpuSchedulerSetParams.from_ptr(&(self._ptr[0].schedulerParams), self._readonly, 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 + 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_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 __from_data(data, "vgpu_scheduler_state_v1_dtype", vgpu_scheduler_state_v1_dtype, VgpuSchedulerState_v1.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlVgpuSchedulerState_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerState_v1") + memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerState_v1_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +grid_licensable_features_dtype = _numpy.dtype([ + ("is_grid_license_supported", _numpy.int32, ), + ("licensable_features_count", _numpy.uint32, ), + ("grid_licensable_features", grid_licensable_feature_dtype, (3,)), + ], align=True) + + +cdef class GridLicensableFeatures: + """Empty-initialize an instance of `nvmlGridLicensableFeatures_t`. + + + .. seealso:: `nvmlGridLicensableFeatures_t` + """ + cdef: + nvmlGridLicensableFeatures_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlGridLicensableFeatures_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GridLicensableFeatures") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlGridLicensableFeatures_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlGridLicensableFeatures_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GridLicensableFeatures") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGridLicensableFeatures_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def grid_licensable_features(self): + """GridLicensableFeature: """ + return GridLicensableFeature.from_ptr(&(self._ptr[0].gridLicensableFeatures), 3, self._readonly) + + @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)}") + memcpy(&(self._ptr[0].gridLicensableFeatures), (val_._get_ptr()), sizeof(nvmlGridLicensableFeature_t) * 3) + + @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 + + @property + def licensable_features_count(self): + """int: """ + return self._ptr[0].licensableFeaturesCount + + @licensable_features_count.setter + def licensable_features_count(self, val): + if self._readonly: + raise ValueError("This GridLicensableFeatures instance is read-only") + self._ptr[0].licensableFeaturesCount = val + + @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 __from_data(data, "grid_licensable_features_dtype", grid_licensable_features_dtype, GridLicensableFeatures.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlGridLicensableFeatures_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating GridLicensableFeatures") + memcpy((obj._ptr), ptr, sizeof(nvmlGridLicensableFeatures_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + +nv_link_info_v2_dtype = _numpy.dtype([ + ("version", _numpy.uint32, ), + ("is_nvle_enabled", _numpy.uint32, ), + ("firmware_info", nvlink_firmware_info_dtype, ), + ], align=True) + + +cdef class NvLinkInfo_v2: + """Empty-initialize an instance of `nvmlNvLinkInfo_v2_t`. + + + .. seealso:: `nvmlNvLinkInfo_v2_t` + """ + cdef: + nvmlNvLinkInfo_v2_t *_ptr + object _owner + bint _readonly + + def __init__(self): + self._ptr = calloc(1, sizeof(nvmlNvLinkInfo_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvLinkInfo_v2") + self._owner = None + self._readonly = False + + def __dealloc__(self): + if self._owner is None: + free(self._ptr) + + 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 (memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvLinkInfo_v2_t)) == 0) + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = malloc(sizeof(nvmlNvLinkInfo_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvLinkInfo_v2") + memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvLinkInfo_v2_t)) + self._owner = None + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def firmware_info(self): + """NvlinkFirmwareInfo: OUT - NVLINK Firmware info.""" + return NvlinkFirmwareInfo.from_ptr(&(self._ptr[0].firmwareInfo), self._readonly, 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 + 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_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 __from_data(data, "nv_link_info_v2_dtype", nv_link_info_v2_dtype, NvLinkInfo_v2.from_ptr) + + @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: + obj._ptr = malloc(sizeof(nvmlNvLinkInfo_v2_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating NvLinkInfo_v2") + memcpy((obj._ptr), ptr, sizeof(nvmlNvLinkInfo_v2_t)) + obj._owner = None + else: + obj._ptr = ptr + obj._owner = owner + obj._readonly = readonly + return obj + + + +cpdef init_v2(): + """Initialize NVML, but don't initialize any GPUs yet. + + .. seealso:: `nvmlInit_v2` + """ + with nogil: + __status__ = nvmlInit_v2() + check_status(__status__) + + +cpdef init_with_flags(unsigned int flags): + """nvmlInitWithFlags is a variant of nvmlInit(), that allows passing a set of boolean values modifying the behaviour of nvmlInit(). Other than the "flags" parameter it is completely similar to ``nvmlInit_v2``. + + Args: + flags (unsigned int): behaviour modifier flags. + + .. seealso:: `nvmlInitWithFlags` + """ + with nogil: + __status__ = nvmlInitWithFlags(flags) + check_status(__status__) + + +cpdef shutdown(): + """Shut down NVML by releasing all GPU resources previously allocated with :func:`init_v2`. + + .. 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. + + Args: + result (Return): NVML error code to convert. + + .. seealso:: `nvmlErrorString` + """ + cdef bytes _output_ + _output_ = nvmlErrorString(<_Return>result) + return _output_.decode() + + +cpdef str system_get_driver_version(): + """Retrieves the version of the system's graphics driver. + + .. seealso:: `nvmlSystemGetDriverVersion` + """ + cdef unsigned int length = 80 + cdef char[80] version + with nogil: + __status__ = nvmlSystemGetDriverVersion(version, length) + check_status(__status__) + return cpython.PyUnicode_FromString(version) + + +cpdef str system_get_nvml_version(): + """Retrieves the version of the NVML library. + + .. seealso:: `nvmlSystemGetNVMLVersion` + """ + cdef unsigned int length = 80 + cdef char[80] version + with nogil: + __status__ = nvmlSystemGetNVMLVersion(version, length) + check_status(__status__) + return cpython.PyUnicode_FromString(version) + + +cpdef int system_get_cuda_driver_version() except *: + """Retrieves the version of the CUDA driver. + + 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. + + 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. + + Args: + pid (unsigned int): The identifier of the process. + + .. seealso:: `nvmlSystemGetProcessName` + """ + cdef unsigned int length = 1024 + cdef char[1024] name + with nogil: + __status__ = nvmlSystemGetProcessName(pid, name, length) + check_status(__status__) + return 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. + + .. 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: + return hwbc_entries + with nogil: + __status__ = nvmlSystemGetHicVersion(hwbc_count, hwbc_entries_ptr) + check_status(__status__) + return hwbc_entries + + +cpdef unsigned int unit_get_count() except? 0: + """Retrieves the number of units in the system. + + 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_ind_ex(unsigned int ind_ex) except? 0: + """Acquire the handle for a particular unit, based on its ind_ex. + + Args: + ind_ex (unsigned int): The ind_ex 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(ind_ex, &unit) + check_status(__status__) + return unit + + +cpdef object unit_get_unit_info(intptr_t unit) : + """Retrieves the static information associated with a unit. + + 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. + + 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. + + 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. + + 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. + + 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 unsigned int device_get_count_v2() except? 0: + """Retrieves the number of compute devices in the system. A compute device is a single GPU. + + Returns: + unsigned int: Reference in which to return the number of accessible devices. + + .. 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. + + Args: + device (intptr_t): NVML device handle. + + Returns: + nvmlDeviceAttributes_t: Device attributes. + + .. 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 ind_ex) except? 0: + """Acquire the handle for a particular device, based on its ind_ex. + + Args: + ind_ex (unsigned int): The ind_ex of the target GPU, >= 0 and < ``accessibleDevices``. + + Returns: + intptr_t: Reference in which to return the device handle. + + .. seealso:: `nvmlDeviceGetHandleByIndex_v2` + """ + cdef Device device + with nogil: + __status__ = nvmlDeviceGetHandleByIndex_v2(ind_ex, &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. + + 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. + + 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. + + .. 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_uuidv(intptr_t 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: + 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 + with nogil: + __status__ = nvmlDeviceGetHandleByUUIDV(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. + + 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. + + .. 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. + + Args: + device (intptr_t): The identifier of the target device. + + .. seealso:: `nvmlDeviceGetName` + """ + cdef unsigned int length = 96 + cdef char[96] name + with nogil: + __status__ = nvmlDeviceGetName(device, name, length) + check_status(__status__) + return cpython.PyUnicode_FromString(name) + + +cpdef int device_get_brand(intptr_t device) except? -1: + """Retrieves the brand of this device. + + 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_ind_ex(intptr_t device) except? 0: + """Retrieves the NVML index of this device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Reference in which to return the NVML index of the device. + + .. seealso:: `nvmlDeviceGetIndex` + """ + cdef unsigned int ind_ex + with nogil: + __status__ = nvmlDeviceGetIndex(device, &ind_ex) + check_status(__status__) + return ind_ex + + +cpdef str device_get_serial(intptr_t device): + """Retrieves the globally unique board serial number associated with this device's board. + + Args: + device (intptr_t): The identifier of the target device. + + .. seealso:: `nvmlDeviceGetSerial` + """ + cdef unsigned int length = 30 + cdef char[30] serial + with nogil: + __status__ = nvmlDeviceGetSerial(device, serial, length) + check_status(__status__) + return 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. + + 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. + + Args: + device (intptr_t): The identifier of the target device. + node_set_size (unsigned int): The size of the nodeSet array that is safe to access. + scope (unsigned int): Array reference in which to return a bitmask of NODEs, 64 NODEs per unsigned long on 64-bit machines, 32 on 32-bit machines. + + .. seealso:: `nvmlDeviceGetMemoryAffinity` + """ + if node_set_size == 0: + return view.array(shape=(1,), itemsize=sizeof(unsigned long), format="L", mode="c")[:0] + cdef view.array node_set = view.array(shape=(node_set_size,), itemsize=sizeof(unsigned long), format="L", mode="c") + cdef unsigned long *node_set_ptr = (node_set.data) + 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. + + Args: + device (intptr_t): The identifier of the target device. + cpu_set_size (unsigned int): The size of the cpuSet array that is safe to access. + scope (unsigned int): Array reference in which to return a bitmask of CPUs, 64 CPUs per unsigned long on 64-bit machines, 32 on 32-bit machines. + + .. seealso:: `nvmlDeviceGetCpuAffinityWithinScope` + """ + if cpu_set_size == 0: + return view.array(shape=(1,), itemsize=sizeof(unsigned long), format="L", mode="c")[:0] + cdef view.array cpu_set = view.array(shape=(cpu_set_size,), itemsize=sizeof(unsigned long), format="L", mode="c") + cdef unsigned long *cpu_set_ptr = (cpu_set.data) + 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``. + + Args: + device (intptr_t): The identifier of the target device. + cpu_set_size (unsigned int): The size of the cpuSet array that is safe to access. + + .. seealso:: `nvmlDeviceGetCpuAffinity` + """ + if cpu_set_size == 0: + return view.array(shape=(1,), itemsize=sizeof(unsigned long), format="L", mode="c")[:0] + cdef view.array cpu_set = view.array(shape=(cpu_set_size,), itemsize=sizeof(unsigned long), format="L", mode="c") + cdef unsigned long *cpu_set_ptr = (cpu_set.data) + 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. + + 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. + + 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. + + .. 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 int device_get_p2p_status(intptr_t device1, intptr_t device2, int p2p_ind_ex) 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_ind_ex (GpuP2PCapsIndex): p2p Capability Index being looked for between ``device1`` and ``device2``. + + Returns: + int: Reference in which to return the status of the ``p2p_ind_ex`` between ``device1`` and ``device2``. + + .. seealso:: `nvmlDeviceGetP2PStatus` + """ + cdef _GpuP2PStatus p2p_status + with nogil: + __status__ = nvmlDeviceGetP2PStatus(device1, device2, <_GpuP2PCapsIndex>p2p_ind_ex, &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. + + Args: + device (intptr_t): The identifier of the target device. + + .. seealso:: `nvmlDeviceGetUUID` + """ + cdef unsigned int length = 96 + cdef char[96] uuid + with nogil: + __status__ = nvmlDeviceGetUUID(device, uuid, length) + check_status(__status__) + return 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]. + + 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. + + Args: + device (intptr_t): Identifier of the target device. + + .. seealso:: `nvmlDeviceGetBoardPartNumber` + """ + cdef unsigned int length = 80 + cdef char[80] part_number + with nogil: + __status__ = nvmlDeviceGetBoardPartNumber(device, part_number, length) + check_status(__status__) + return 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. + + Args: + device (intptr_t): The identifier of the target device. + object (InforomObject): The target infoROM object. + + .. seealso:: `nvmlDeviceGetInforomVersion` + """ + cdef unsigned int length = 16 + cdef char[16] version + with nogil: + __status__ = nvmlDeviceGetInforomVersion(device, <_InforomObject>object, version, length) + check_status(__status__) + return cpython.PyUnicode_FromString(version) + + +cpdef str device_get_inforom_image_version(intptr_t device): + """Retrieves the global infoROM image version. + + Args: + device (intptr_t): The identifier of the target device. + + .. seealso:: `nvmlDeviceGetInforomImageVersion` + """ + cdef unsigned int length = 16 + cdef char[16] version + with nogil: + __status__ = nvmlDeviceGetInforomImageVersion(device, version, length) + check_status(__status__) + return 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. + + 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. + + Args: + device (intptr_t): The identifier of the target device. + + .. seealso:: `nvmlDeviceValidateInforom` + """ + with nogil: + __status__ = nvmlDeviceValidateInforom(device) + check_status(__status__) + + +cpdef unsigned long device_get_last_bbx_flush_time(intptr_t device, intptr_t timestamp) except? 0: + """Retrieves the timestamp and the duration of the last flush of the BBX (blackbox) infoROM object during the current run. + + Args: + device (intptr_t): The identifier of the target device. + timestamp (intptr_t): The start timestamp of the last BBX Flush. + + Returns: + unsigned long: The duration (us) of the last BBX Flush. + + .. seealso:: `nvmlDeviceGetLastBBXFlushTime` + """ + cdef unsigned long duration_us + with nogil: + __status__ = nvmlDeviceGetLastBBXFlushTime(device, timestamp, &duration_us) + check_status(__status__) + return duration_us + + +cpdef int device_get_display_mode(intptr_t device) except? -1: + """Retrieves the display mode for the device. + + 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. + + 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. + + 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. + + 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 = sizeof(nvmlPciInfoExt_v1_t) | (1 << 24) + 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. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlPciInfo_t: Reference in which to return the PCI info. + + .. 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. + + 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. + + 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. + + 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. + + 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. + + 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. + + 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. + + 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. + + 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. + + 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:: `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. + + 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. + + 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``. + + Args: + device (intptr_t): The identifier of the target device. + + .. seealso:: `nvmlDeviceGetSupportedMemoryClocks` + """ + cdef unsigned int[1] count = [0] + with nogil: + __status__ = nvmlDeviceGetSupportedMemoryClocks(device, count, NULL) + check_status_size(__status__) + if count[0] == 0: + return view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] + cdef view.array clocks_m_hz = view.array(shape=(count[0],), itemsize=sizeof(unsigned int), format="I", mode="c") + cdef unsigned int *clocks_m_hz_ptr = (clocks_m_hz.data) + with nogil: + __status__ = nvmlDeviceGetSupportedMemoryClocks(device, count, clocks_m_hz_ptr) + check_status(__status__) + return clocks_m_hz + + +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``. + + 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. + + .. seealso:: `nvmlDeviceGetSupportedGraphicsClocks` + """ + cdef unsigned int[1] count = [0] + with nogil: + __status__ = nvmlDeviceGetSupportedGraphicsClocks(device, memory_clock_m_hz, count, NULL) + check_status_size(__status__) + if count[0] == 0: + return view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] + cdef view.array clocks_m_hz = view.array(shape=(count[0],), itemsize=sizeof(unsigned int), format="I", mode="c") + cdef unsigned int *clocks_m_hz_ptr = (clocks_m_hz.data) + with nogil: + __status__ = nvmlDeviceGetSupportedGraphicsClocks(device, memory_clock_m_hz, count, clocks_m_hz_ptr) + check_status(__status__) + return clocks_m_hz + + +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 ``isEnabled``. + + 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. + + 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. + + 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 object device_get_fan_speed_rpm(intptr_t device) : + """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. + + Returns: + nvmlFanSpeedInfo_v1_t: Structure specifying the index of the target fan (input) and retrieved fan speed value (output). + + .. seealso:: `nvmlDeviceGetFanSpeedRPM` + """ + cdef FanSpeedInfo_v1 fan_speed_py = FanSpeedInfo_v1() + cdef nvmlFanSpeedInfo_t *fan_speed = (fan_speed_py._get_ptr()) + fan_speed.version = sizeof(nvmlFanSpeedInfo_v1_t) | (1 << 24) + with nogil: + __status__ = nvmlDeviceGetFanSpeedRPM(device, fan_speed) + check_status(__status__) + return fan_speed_py + + +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. + + 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. + + 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. + + 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. + + 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. + + 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 = sizeof(nvmlCoolerInfo_v1_t) | (1 << 24) + 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. + + 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_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: + nvmlMarginTemperature_v1_t: Versioned structure in which to return the temperature reading. + + .. seealso:: `nvmlDeviceGetMarginTemperature` + """ + cdef MarginTemperature_v1 margin_temp_info_py = MarginTemperature_v1() + cdef nvmlMarginTemperature_t *margin_temp_info = (margin_temp_info_py._get_ptr()) + margin_temp_info.version = sizeof(nvmlMarginTemperature_v1_t) | (1 << 24) + with nogil: + __status__ = nvmlDeviceGetMarginTemperature(device, margin_temp_info) + check_status(__status__) + return margin_temp_info_py + + +cpdef object device_get_thermal_settings(intptr_t device, unsigned int sensor_ind_ex) : + """Used to execute a list of thermal system instructions. + + Args: + device (intptr_t): The identifier of the target device. + sensor_ind_ex (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_ind_ex, 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. + + 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. + + 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. + + .. 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``. + + 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. + + 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 object device_get_clock_offsets(intptr_t device) : + """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_t *info = (info_py._get_ptr()) + info.version = sizeof(nvmlClockOffset_v1_t) | (1 << 24) + with nogil: + __status__ = nvmlDeviceGetClockOffsets(device, info) + check_status(__status__) + return info_py + + +cpdef device_set_clock_offsets(intptr_t device, intptr_t info): + """Control current clock offset of some clock domain for a given PState. + + 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` + """ + with nogil: + __status__ = nvmlDeviceSetClockOffsets(device, info) + check_status(__status__) + + +cpdef object 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: + nvmlDevicePerfModes_v1_t: Reference in which to return the performance level string. + + .. seealso:: `nvmlDeviceGetPerformanceModes` + """ + cdef DevicePerfModes_v1 perf_modes_py = DevicePerfModes_v1() + cdef nvmlDevicePerfModes_t *perf_modes = (perf_modes_py._get_ptr()) + perf_modes.version = sizeof(nvmlDevicePerfModes_v1_t) | (1 << 24) + with nogil: + __status__ = nvmlDeviceGetPerformanceModes(device, perf_modes) + check_status(__status__) + return perf_modes_py + + +cpdef object 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: + nvmlDeviceCurrentClockFreqs_v1_t: Reference in which to return the performance level string. + + .. seealso:: `nvmlDeviceGetCurrentClockFreqs` + """ + cdef DeviceCurrentClockFreqs_v1 current_clock_freqs_py = DeviceCurrentClockFreqs_v1() + cdef nvmlDeviceCurrentClockFreqs_t *current_clock_freqs = (current_clock_freqs_py._get_ptr()) + current_clock_freqs.version = sizeof(nvmlDeviceCurrentClockFreqs_v1_t) | (1 << 24) + with nogil: + __status__ = nvmlDeviceGetCurrentClockFreqs(device, current_clock_freqs) + check_status(__status__) + return current_clock_freqs_py + + +cpdef unsigned int device_get_power_management_limit(intptr_t device) except? 0: + """Retrieves the power management limit associated with this device. + + 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. + + 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. + + 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). + + 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. + + 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. + + 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). + + 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. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlMemory_v2_t: Reference in which to return the memory information. + + .. seealso:: `nvmlDeviceGetMemoryInfo_v2` + """ + cdef Memory_v2 memory_py = Memory_v2() + cdef nvmlMemory_v2_t *memory = (memory_py._get_ptr()) + memory.version = sizeof(nvmlMemory_v2_t) | (2 << 24) + 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. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + int: Reference in which to return the current compute mode. + + .. 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. + + 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. + + .. 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_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: + + - nvmlDramEncryptionInfo_v1_t: Reference in which to return the current DRAM Encryption mode. + - nvmlDramEncryptionInfo_v1_t: Reference in which to return the pending DRAM Encryption mode. + + .. seealso:: `nvmlDeviceGetDramEncryptionMode` + """ + cdef nvmlDramEncryptionInfo_t current + cdef nvmlDramEncryptionInfo_t pending + with nogil: + __status__ = nvmlDeviceGetDramEncryptionMode(device, ¤t, &pending) + check_status(__status__) + return (current, pending) + + +cpdef device_set_dram_encryption_mode(intptr_t device, intptr_t dram_encryption): + """Set the DRAM Encryption mode for the device. + + Args: + device (intptr_t): The identifier of the target device. + dram_encryption (intptr_t): The target DRAM Encryption mode. + + .. seealso:: `nvmlDeviceSetDramEncryptionMode` + """ + with nogil: + __status__ = nvmlDeviceSetDramEncryptionMode(device, dram_encryption) + check_status(__status__) + + +cpdef tuple device_get_ecc_mode(intptr_t device): + """Retrieves the current and pending ECC modes for the device. + + 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. + + 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 boardId from 0-N. Devices with the same boardId 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 boardId 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). + + 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 ``multiGpuBool`` to a non-zero value. + + 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. + + 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. + + 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. + + .. 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. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlUtilization_t: Reference in which to return the utilization information. + + .. 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. + + 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. + + .. 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. + + 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. + + 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. + + Args: + device (intptr_t): The identifier of the target device. + + .. 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: + return session_infos + with nogil: + __status__ = nvmlDeviceGetEncoderSessions(device, session_count, session_infos_ptr) + check_status(__status__) + return session_infos + + +cpdef tuple device_get_decoder_utilization(intptr_t device): + """Retrieves the current utilization and sampling size in microseconds for the Decoder. + + 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. + + .. 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. + + 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. + + .. 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). + + 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. + + .. 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. + + 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. + + Args: + device (intptr_t): The identifier of the target device. + + .. 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: + return session_info + with nogil: + __status__ = nvmlDeviceGetFBCSessions(device, session_count, session_info_ptr) + check_status(__status__) + return session_info + + +cpdef tuple device_get_driver_model_v2(intptr_t device): + """Retrieves the current and pending driver model for the device. + + 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. + + Args: + device (intptr_t): The identifier of the target device. + + .. seealso:: `nvmlDeviceGetVbiosVersion` + """ + cdef unsigned int length = 32 + cdef char[32] version + with nogil: + __status__ = nvmlDeviceGetVbiosVersion(device, version, length) + check_status(__status__) + return 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. + + 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. + + Args: + device (intptr_t): The device handle or MIG device handle. + + .. 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: + return infos + with nogil: + __status__ = nvmlDeviceGetComputeRunningProcesses_v3(device, info_count, infos_ptr) + check_status(__status__) + return infos + + +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. + + Args: + device (intptr_t): The device handle or MIG device handle. + + .. 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: + return infos + with nogil: + __status__ = nvmlDeviceGetMPSComputeRunningProcesses_v3(device, info_count, infos_ptr) + check_status(__status__) + return infos + + +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. + + 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. + + 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 object device_get_bar1_memory_info(intptr_t device) : + """Gets Total, Available and Used size of BAR1 memory. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlBAR1Memory_t: Reference in which BAR1 memory information is returned. + + .. 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. + + .. 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, ...). + + 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 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_py = GpuFabricInfo_v3() + cdef nvmlGpuFabricInfoV_t *gpu_fabric_info = (gpu_fabric_info_py._get_ptr()) + gpu_fabric_info.version = sizeof(nvmlGpuFabricInfo_v3_t) | (3 << 24) + with nogil: + __status__ = nvmlDeviceGetGpuFabricInfoV(device, gpu_fabric_info) + check_status(__status__) + return gpu_fabric_info_py + + +cpdef object system_get_conf_compute_capabilities() : + """Get Conf Computing System capabilities. + + 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. + + 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. + + 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. + + 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. + + 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. + + 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 object device_get_conf_compute_gpu_attestation_report(intptr_t device) : + """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: + __status__ = nvmlDeviceGetConfComputeGpuAttestationReport(device, gpu_atst_report) + check_status(__status__) + return gpu_atst_report_py + + +cpdef object system_get_conf_compute_key_rotation_threshold_info() : + """Get Conf Computing key rotation threshold detail. + + Returns: + nvmlConfComputeGetKeyRotationThresholdInfo_v1_t: Reference in which to return the key rotation threshold data. + + .. seealso:: `nvmlSystemGetConfComputeKeyRotationThresholdInfo` + """ + cdef ConfComputeGetKeyRotationThresholdInfo_v1 p_key_rotation_thr_info_py = ConfComputeGetKeyRotationThresholdInfo_v1() + cdef nvmlConfComputeGetKeyRotationThresholdInfo_t *p_key_rotation_thr_info = (p_key_rotation_thr_info_py._get_ptr()) + p_key_rotation_thr_info.version = sizeof(nvmlConfComputeGetKeyRotationThresholdInfo_v1_t) | (1 << 24) + with nogil: + __status__ = nvmlSystemGetConfComputeKeyRotationThresholdInfo(p_key_rotation_thr_info) + check_status(__status__) + return p_key_rotation_thr_info_py + + +cpdef device_set_conf_compute_unprotected_mem_size(intptr_t device, unsigned long long size_ki_b): + """Set Conf Computing Unprotected Memory Size. + + 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. + + 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 system_set_conf_compute_key_rotation_threshold_info(intptr_t p_key_rotation_thr_info): + """Set Conf Computing key rotation threshold. + + Args: + p_key_rotation_thr_info (intptr_t): Reference to the key rotation threshold data. + + .. seealso:: `nvmlSystemSetConfComputeKeyRotationThresholdInfo` + """ + with nogil: + __status__ = nvmlSystemSetConfComputeKeyRotationThresholdInfo(p_key_rotation_thr_info) + check_status(__status__) + + +cpdef object system_get_conf_compute_settings() : + """Get Conf Computing System Settings. + + 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 = sizeof(nvmlSystemConfComputeSettings_v1_t) | (1 << 24) + 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. + + 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. + + 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. + + 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 = sizeof(nvmlEccSramErrorStatus_v1_t) | (1 << 24) + 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. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + int: Reference in which to return the current accounting mode. + + .. 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. + + 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. + + .. 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. + + Args: + device (intptr_t): The identifier of the target device. + + .. seealso:: `nvmlDeviceGetAccountingPids` + """ + cdef unsigned int[1] count = [0] + with nogil: + __status__ = nvmlDeviceGetAccountingPids(device, count, NULL) + check_status_size(__status__) + if count[0] == 0: + return view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] + cdef view.array pids = view.array(shape=(count[0],), itemsize=sizeof(unsigned int), format="I", mode="c") + cdef unsigned int *pids_ptr = (pids.data) + with nogil: + __status__ = nvmlDeviceGetAccountingPids(device, count, pids_ptr) + check_status(__status__) + return pids + + +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. + + 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. + + Args: + device (intptr_t): The identifier of the target device. + cause (PageRetirementCause): Filter page addresses by cause of retirement. + + .. seealso:: `nvmlDeviceGetRetiredPages` + """ + cdef unsigned int[1] page_count = [0] + with nogil: + __status__ = nvmlDeviceGetRetiredPages(device, <_PageRetirementCause>cause, page_count, NULL) + check_status_size(__status__) + if page_count[0] == 0: + return view.array(shape=(1,), itemsize=sizeof(unsigned long long), format="Q", mode="c")[:0] + cdef view.array addresses = view.array(shape=(page_count[0],), itemsize=sizeof(unsigned long long), format="Q", mode="c") + cdef unsigned long long *addresses_ptr = (addresses.data) + with nogil: + __status__ = nvmlDeviceGetRetiredPages(device, <_PageRetirementCause>cause, page_count, addresses_ptr) + check_status(__status__) + return addresses + + +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. + + 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. isPending indicates whether or not there are pending remappings. A reset will be required to actually remap the row. failureOccurred 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. + + 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. + + .. 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. + + 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. + + Args: + device (intptr_t): The identifier of the target device. + last_seen_time_stamp (unsigned long long): Pointer to caller-supplied buffer in which guest process utilization samples are returned. + + .. 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: + return utilization + with nogil: + __status__ = nvmlDeviceGetProcessUtilization(device, utilization_ptr, process_samples_count, last_seen_time_stamp) + check_status(__status__) + return utilization + + +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_v2 platform_info_py = PlatformInfo_v2() + cdef nvmlPlatformInfo_t *platform_info = (platform_info_py._get_ptr()) + platform_info.version = sizeof(nvmlPlatformInfo_v2_t) | (2 << 24) + with nogil: + __status__ = nvmlDeviceGetPlatformInfo(device, platform_info) + check_status(__status__) + return platform_info_py + + +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). + + 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. + + 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. + + Args: + device (intptr_t): The identifier of the target device. + mode (ComputeMode): The target compute mode. + + .. 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. + + 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. + + 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. + + 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. + + 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. + + 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. + + 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. + + 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. + + 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. + + 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. + + 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. + + 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_temperature_threshold(intptr_t device, int threshold_type, intptr_t 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 (intptr_t): Reference which hold the value to be set. + + .. seealso:: `nvmlDeviceSetTemperatureThreshold` + """ + with nogil: + __status__ = nvmlDeviceSetTemperatureThreshold(device, <_TemperatureThresholds>threshold_type, temp) + check_status(__status__) + + +cpdef device_set_power_management_limit(intptr_t device, unsigned int limit): + """Set new power limit of this device. + + Args: + device (intptr_t): The identifier of the target device. + limit (unsigned int): Power management limit in milliwatts to set. + + .. seealso:: `nvmlDeviceSetPowerManagementLimit` + """ + with nogil: + __status__ = nvmlDeviceSetPowerManagementLimit(device, limit) + check_status(__status__) + + +cpdef device_set_gpu_operation_mode(intptr_t device, int mode): + """Sets new GOM. See ``nvmlGpuOperationMode_t`` for details. + + 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. + + 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. + + 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. + + Args: + device (intptr_t): The identifier of the target device. + mode (EnableState): The target accounting mode. + + .. 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. + + Args: + device (intptr_t): The identifier of the target device. + + .. seealso:: `nvmlDeviceClearAccountingPids` + """ + with nogil: + __status__ = nvmlDeviceClearAccountingPids(device) + check_status(__status__) + + +cpdef device_set_power_management_limit_v2(intptr_t device, intptr_t power_value): + """Set new power limit of this device. + + Args: + device (intptr_t): The identifier of the target device. + power_value (intptr_t): Power management limit in milliwatts to set. + + .. seealso:: `nvmlDeviceSetPowerManagementLimit_v2` + """ + with nogil: + __status__ = nvmlDeviceSetPowerManagementLimit_v2(device, power_value) + check_status(__status__) + + +cpdef int device_get_nv_link_state(intptr_t device, unsigned int link) except? -1: + """Retrieves the state of the device's NvLink for the link specified. + + 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_nv_link_version(intptr_t device, unsigned int link) except? 0: + """Retrieves the version of the device's NvLink for the link specified. + + 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_nv_link_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. + + 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_nv_link_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. + + 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_nv_link_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. + + 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_nv_link_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. + + 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_nv_link_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 device_set_nv_link_device_low_power_threshold(intptr_t device, intptr_t info): + """Set NvLink Low Power Threshold for device. + + Args: + device (intptr_t): The identifier of the target device. + info (intptr_t): Reference to ``nvmlNvLinkPowerThres_t`` struct input parameters. + + .. seealso:: `nvmlDeviceSetNvLinkDeviceLowPowerThreshold` + """ + with nogil: + __status__ = nvmlDeviceSetNvLinkDeviceLowPowerThreshold(device, info) + check_status(__status__) + + +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. + + 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 = sizeof(nvmlNvlinkSupportedBwModes_v1_t) | (1 << 24) + 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. + + 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 = sizeof(nvmlNvlinkGetBwMode_v1_t) | (1 << 24) + 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, intptr_t set_bw_mode): + """Set the NvLink Reduced Bandwidth Mode for the device. + + Args: + device (intptr_t): The identifier of the target device. + set_bw_mode (intptr_t): Reference to ``nvmlNvlinkSetBwMode_t``. + + .. seealso:: `nvmlDeviceSetNvlinkBwMode` + """ + set_bw_mode.version = sizeof(nvmlNvlinkSetBwMode_v1_t) | (1 << 24) + with nogil: + __status__ = nvmlDeviceSetNvlinkBwMode(device, set_bw_mode) + check_status(__status__) + + +cpdef intptr_t event_set_create() except? 0: + """Create an empty set of events. Event set should be freed by ``nvmlEventSetFree``. + + 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``. + + 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. + + 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. + + 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. + + Args: + set (intptr_t): Reference to events to be released. + + .. seealso:: `nvmlEventSetFree` + """ + with nogil: + __status__ = nvmlEventSetFree(set) + check_status(__status__) + + +cpdef system_event_set_create(intptr_t request): + """Create an empty set of system events. Event set should be freed by ``nvmlSystemEventSetFree``. + + Args: + request (intptr_t): Reference to nvmlSystemEventSetCreateRequest_t. + + .. seealso:: `nvmlSystemEventSetCreate` + """ + with nogil: + __status__ = nvmlSystemEventSetCreate(request) + check_status(__status__) + + +cpdef system_event_set_free(intptr_t request): + """Releases system event set. + + Args: + request (intptr_t): Reference to nvmlSystemEventSetFreeRequest_t. + + .. seealso:: `nvmlSystemEventSetFree` + """ + with nogil: + __status__ = nvmlSystemEventSetFree(request) + check_status(__status__) + + +cpdef system_register_events(intptr_t request): + """Starts recording of events on system and add the events to specified ``nvmlSystemEventSet_t``. + + Args: + request (intptr_t): Reference to the struct nvmlSystemRegisterEventRequest_t. + + .. seealso:: `nvmlSystemRegisterEvents` + """ + with nogil: + __status__ = nvmlSystemRegisterEvents(request) + check_status(__status__) + + +cpdef system_event_set_wait(intptr_t request): + """Waits on system events and delivers events. + + Args: + request (intptr_t): Reference in which to nvmlSystemEventSetWaitRequest_t. + + .. seealso:: `nvmlSystemEventSetWait` + """ + with nogil: + __status__ = nvmlSystemEventSetWait(request) + check_status(__status__) + + +cpdef device_modify_drain_state(intptr_t 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. + + 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` + """ + with nogil: + __status__ = nvmlDeviceModifyDrainState(pci_info, <_EnableState>new_state) + check_status(__status__) + + +cpdef int device_query_drain_state(intptr_t 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. + + 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 _EnableState current_state + with nogil: + __status__ = nvmlDeviceQueryDrainState(pci_info, ¤t_state) + check_status(__status__) + return current_state + + +cpdef device_remove_gpu_v2(intptr_t 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. + + 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` + """ + with nogil: + __status__ = nvmlDeviceRemoveGpu_v2(pci_info, <_DetachGpuState>gpu_state, <_PcieLinkState>link_state) + check_status(__status__) + + +cpdef device_discover_gpus(intptr_t 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. + + 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` + """ + with nogil: + __status__ = nvmlDeviceDiscoverGpus(pci_info) + 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. + + 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. + + 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. + + 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 object 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: + nvmlVgpuHeterogeneousMode_v1_t: Pointer to the caller-provided structure of nvmlVgpuHeterogeneousMode_t. + + .. seealso:: `nvmlDeviceGetVgpuHeterogeneousMode` + """ + cdef VgpuHeterogeneousMode_v1 p_heterogeneous_mode_py = VgpuHeterogeneousMode_v1() + cdef nvmlVgpuHeterogeneousMode_t *p_heterogeneous_mode = (p_heterogeneous_mode_py._get_ptr()) + p_heterogeneous_mode.version = sizeof(nvmlVgpuHeterogeneousMode_v1_t) | (1 << 24) + with nogil: + __status__ = nvmlDeviceGetVgpuHeterogeneousMode(device, p_heterogeneous_mode) + check_status(__status__) + return p_heterogeneous_mode_py + + +cpdef device_set_vgpu_heterogeneous_mode(intptr_t device, intptr_t p_heterogeneous_mode): + """Enable or disable vGPU heterogeneous mode for the device. + + Args: + device (intptr_t): Identifier of the target device. + p_heterogeneous_mode (intptr_t): Pointer to the caller-provided structure of nvmlVgpuHeterogeneousMode_t. + + .. seealso:: `nvmlDeviceSetVgpuHeterogeneousMode` + """ + with nogil: + __status__ = nvmlDeviceSetVgpuHeterogeneousMode(device, p_heterogeneous_mode) + check_status(__status__) + + +cpdef object 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: + nvmlVgpuPlacementId_v1_t: Pointer to vGPU placement ID structure ``nvmlVgpuPlacementId_t``. + + .. seealso:: `nvmlVgpuInstanceGetPlacementId` + """ + cdef VgpuPlacementId_v1 p_placement_py = VgpuPlacementId_v1() + cdef nvmlVgpuPlacementId_t *p_placement = (p_placement_py._get_ptr()) + p_placement.version = sizeof(nvmlVgpuPlacementId_v1_t) | (1 << 24) + with nogil: + __status__ = nvmlVgpuInstanceGetPlacementId(vgpu_instance, p_placement) + check_status(__status__) + return p_placement_py + + +cpdef object device_get_vgpu_type_supported_placements(intptr_t device, unsigned int vgpu_type_id) : + """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. + + 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: + __status__ = nvmlDeviceGetVgpuTypeSupportedPlacements(device, vgpu_type_id, p_placement_list) + check_status(__status__) + return p_placement_list_py + + +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 object 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: + nvmlVgpuRuntimeState_v1_t: Pointer to the vGPU runtime state's structure ``nvmlVgpuRuntimeState_t``. + + .. seealso:: `nvmlVgpuInstanceGetRuntimeStateSize` + """ + cdef VgpuRuntimeState_v1 p_state_py = VgpuRuntimeState_v1() + cdef nvmlVgpuRuntimeState_t *p_state = (p_state_py._get_ptr()) + p_state.version = sizeof(nvmlVgpuRuntimeState_v1_t) | (1 << 24) + with nogil: + __status__ = nvmlVgpuInstanceGetRuntimeStateSize(vgpu_instance, p_state) + check_status(__status__) + return p_state_py + + +cpdef device_set_vgpu_capabilities(intptr_t device, int capability, int state): + """Set the desirable vGPU capability of a device. + + 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. + + 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. + + 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. + + 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 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``. + + Args: + vgpu_type_id (unsigned int): Handle to vGPU type. + + .. seealso:: `nvmlVgpuTypeGetClass` + """ + cdef unsigned int[1] size = [0] + with nogil: + __status__ = nvmlVgpuTypeGetClass(vgpu_type_id, NULL, size) + check_status_size(__status__) + if size[0] == 0: + return "" + cdef bytes _vgpu_type_class_ = bytes(size[0]) + cdef char* vgpu_type_class = _vgpu_type_class_ + with nogil: + __status__ = nvmlVgpuTypeGetClass(vgpu_type_id, vgpu_type_class, size) + check_status(__status__) + return cpython.PyUnicode_FromString(vgpu_type_class) + + +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 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_FromString(vgpu_type_name) + + +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. + + 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. + + 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. + + 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. + + 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_ind_ex): + """Retrieve vGPU display head's maximum supported resolution. + + Args: + vgpu_type_id (unsigned int): Handle to vGPU type. + display_ind_ex (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_ind_ex, &xdim, &ydim) + check_status(__status__) + return (xdim, ydim) + + +cpdef vgpu_type_get_license(unsigned int vgpu_type_id, intptr_t vgpu_type_license_string, unsigned int size): + """Retrieve license requirements for a vGPU type. + + Args: + vgpu_type_id (unsigned int): Handle to vGPU type. + vgpu_type_license_string (intptr_t): Pointer to buffer to return license info. + size (unsigned int): Size of ``vgpu_type_license_string`` buffer. + + .. seealso:: `nvmlVgpuTypeGetLicense` + """ + with nogil: + __status__ = nvmlVgpuTypeGetLicense(vgpu_type_id, vgpu_type_license_string, size) + check_status(__status__) + + +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. + + 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. + + 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. + + 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. + + 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 = sizeof(nvmlVgpuTypeBar1Info_v1_t) | (1 << 24) + with nogil: + __status__ = nvmlVgpuTypeGetBAR1Info(vgpu_type_id, bar1info) + check_status(__status__) + return bar1info_py + + +cpdef str vgpu_instance_get_uuid(unsigned int vgpu_instance): + """Retrieve the UUID of a vGPU instance. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + .. seealso:: `nvmlVgpuInstanceGetUUID` + """ + cdef unsigned int size = 80 + cdef char[80] uuid + with nogil: + __status__ = nvmlVgpuInstanceGetUUID(vgpu_instance, uuid, size) + check_status(__status__) + return 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. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + .. seealso:: `nvmlVgpuInstanceGetVmDriverVersion` + """ + cdef unsigned int length = 80 + cdef char[80] version + with nogil: + __status__ = nvmlVgpuInstanceGetVmDriverVersion(vgpu_instance, version, length) + check_status(__status__) + return 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. + + 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]. + + 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. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + Returns: + unsigned int: Reference to return the vgpuTypeId. + + .. 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. + + 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. + + 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. + + 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. + + 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. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + .. 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: + return session_info + with nogil: + __status__ = nvmlVgpuInstanceGetEncoderSessions(vgpu_instance, session_count, session_info_ptr) + check_status(__status__) + return session_info + + +cpdef object vgpu_instance_get_fbc_stats(unsigned int vgpu_instance) : + """Retrieves the active frame buffer capture sessions statistics of a vGPU Instance. + + 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. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + .. 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: + return session_info + with nogil: + __status__ = nvmlVgpuInstanceGetFBCSessions(vgpu_instance, session_count, session_info_ptr) + check_status(__status__) + return session_info + + +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. + + 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. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + .. seealso:: `nvmlVgpuInstanceGetGpuPciId` + """ + cdef unsigned int[1] length = [0] + with nogil: + __status__ = nvmlVgpuInstanceGetGpuPciId(vgpu_instance, NULL, length) + check_status_size(__status__) + if length[0] == 0: + return "" + cdef bytes _vgpu_pci_id_ = bytes(length[0]) + cdef char* vgpu_pci_id = _vgpu_pci_id_ + with nogil: + __status__ = nvmlVgpuInstanceGetGpuPciId(vgpu_instance, vgpu_pci_id, length) + check_status(__status__) + return 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 ``capResult`` should be treated as a boolean, with a non-zero value indicating that the capability is supported. + + 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. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + .. 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 cpython.PyUnicode_FromString(mdev_uuid) + + +cpdef object vgpu_type_get_max_instances_per_gpu_instance() : + """Retrieve the maximum number of vGPU instances per GPU instance for given vGPU type. + + Returns: + nvmlVgpuTypeMaxInstance_v1_t: Pointer to the caller-provided structure of nvmlVgpuTypeMaxInstance_t. + + .. seealso:: `nvmlVgpuTypeGetMaxInstancesPerGpuInstance` + """ + cdef VgpuTypeMaxInstance_v1 p_max_instance_py = VgpuTypeMaxInstance_v1() + cdef nvmlVgpuTypeMaxInstance_t *p_max_instance = (p_max_instance_py._get_ptr()) + p_max_instance.version = sizeof(nvmlVgpuTypeMaxInstance_v1_t) | (1 << 24) + with nogil: + __status__ = nvmlVgpuTypeGetMaxInstancesPerGpuInstance(p_max_instance) + check_status(__status__) + return p_max_instance_py + + +cpdef gpu_instance_set_vgpu_scheduler_state(intptr_t gpu_instance, intptr_t p_scheduler): + """Set vGPU scheduler state for the given GPU instance. + + Args: + gpu_instance (intptr_t): The GPU instance handle. + p_scheduler (intptr_t): Pointer to the caller-provided structure of nvmlVgpuSchedulerState_t. + + .. seealso:: `nvmlGpuInstanceSetVgpuSchedulerState` + """ + with nogil: + __status__ = nvmlGpuInstanceSetVgpuSchedulerState(gpu_instance, p_scheduler) + 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. + + Args: + gpu_instance (intptr_t): The GPU instance handle. + + Returns: + nvmlVgpuSchedulerStateInfo_v1_t: Reference in which ``pSchedulerStateInfo`` 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 = sizeof(nvmlVgpuSchedulerState_v1_t) | (1 << 24) + 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. ``pSchedulerLogInfo`` points to a caller-allocated structure to contain the logs. The number of elements returned will never exceed ``NVML_SCHEDULER_SW_MAX_LOG_ENTRIES``. + + Args: + gpu_instance (intptr_t): The GPU instance handle. + + Returns: + nvmlVgpuSchedulerLogInfo_v1_t: Reference in which ``pSchedulerLogInfo`` 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 = sizeof(nvmlVgpuSchedulerLogInfo_v1_t) | (1 << 24) + with nogil: + __status__ = nvmlGpuInstanceGetVgpuSchedulerLog(gpu_instance, p_scheduler_log_info) + check_status(__status__) + return p_scheduler_log_info_py + + +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: + nvmlVgpuHeterogeneousMode_v1_t: Pointer to the caller-provided structure of nvmlVgpuHeterogeneousMode_t. + + .. seealso:: `nvmlGpuInstanceGetVgpuHeterogeneousMode` + """ + cdef VgpuHeterogeneousMode_v1 p_heterogeneous_mode_py = VgpuHeterogeneousMode_v1() + cdef nvmlVgpuHeterogeneousMode_t *p_heterogeneous_mode = (p_heterogeneous_mode_py._get_ptr()) + p_heterogeneous_mode.version = sizeof(nvmlVgpuHeterogeneousMode_v1_t) | (1 << 24) + with nogil: + __status__ = nvmlGpuInstanceGetVgpuHeterogeneousMode(gpu_instance, p_heterogeneous_mode) + check_status(__status__) + return p_heterogeneous_mode_py + + +cpdef gpu_instance_set_vgpu_heterogeneous_mode(intptr_t gpu_instance, intptr_t p_heterogeneous_mode): + """Enable or disable vGPU heterogeneous mode for the GPU instance. + + Args: + gpu_instance (intptr_t): The GPU instance handle. + p_heterogeneous_mode (intptr_t): Pointer to the caller-provided structure of nvmlVgpuHeterogeneousMode_t. + + .. seealso:: `nvmlGpuInstanceSetVgpuHeterogeneousMode` + """ + with nogil: + __status__ = nvmlGpuInstanceSetVgpuHeterogeneousMode(gpu_instance, p_heterogeneous_mode) + check_status(__status__) + + +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. + + Args: + device (intptr_t): The identifier of the target device. + + .. seealso:: `nvmlDeviceGetPgpuMetadataString` + """ + cdef unsigned int[1] buffer_size = [0] + with nogil: + __status__ = nvmlDeviceGetPgpuMetadataString(device, NULL, buffer_size) + check_status_size(__status__) + if buffer_size[0] == 0: + return "" + cdef bytes _pgpu_metadata_ = bytes(buffer_size[0]) + cdef char* pgpu_metadata = _pgpu_metadata_ + with nogil: + __status__ = nvmlDeviceGetPgpuMetadataString(device, pgpu_metadata, buffer_size) + check_status(__status__) + return cpython.PyUnicode_FromString(pgpu_metadata) + + +cpdef object device_get_vgpu_scheduler_log(intptr_t device) : + """Returns the vGPU Software scheduler logs. ``pSchedulerLog`` points to a caller-allocated structure to contain the logs. The number of elements returned will never exceed ``NVML_SCHEDULER_SW_MAX_LOG_ENTRIES``. + + Args: + device (intptr_t): The identifier of the target ``device``. + + Returns: + nvmlVgpuSchedulerLog_t: Reference in which ``pSchedulerLog`` 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. + + Args: + device (intptr_t): The identifier of the target ``device``. + + Returns: + nvmlVgpuSchedulerGetState_t: Reference in which ``pSchedulerState`` 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. + + Args: + device (intptr_t): The identifier of the target ``device``. + + Returns: + nvmlVgpuSchedulerCapabilities_t: Reference in which ``pCapabilities`` 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. + + 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 set_vgpu_version(intptr_t vgpu_version): + """Override the preset range of vGPU versions supported by the NVIDIA vGPU Manager with a range set by an administrator. + + Args: + vgpu_version (intptr_t): Pointer to a caller-supplied range of supported vGPU versions. + + .. seealso:: `nvmlSetVgpuVersion` + """ + with nogil: + __status__ = nvmlSetVgpuVersion(vgpu_version) + check_status(__status__) + + +cpdef tuple device_get_vgpu_utilization(intptr_t device, unsigned long long last_seen_time_stamp): + """Retrieves current utilization for vGPUs on a physical GPU (device). + + Args: + device (intptr_t): The identifier for the target device. + last_seen_time_stamp (unsigned long long): Return only samples with timestamp greater than last_seen_time_stamp. + + Returns: + A 3-tuple containing: + + - int: Pointer to caller-supplied buffer to hold the type of returned sample values. + - unsigned int: Pointer to caller-supplied array size, and returns number of vGPU instances. + - nvmlVgpuInstanceUtilizationSample_t: Pointer to caller-supplied buffer in which vGPU utilization samples are returned. + + .. seealso:: `nvmlDeviceGetVgpuUtilization` + """ + cdef _ValueType sample_val_type + cdef unsigned int vgpu_instance_samples_count + cdef nvmlVgpuInstanceUtilizationSample_t utilization_samples + with nogil: + __status__ = nvmlDeviceGetVgpuUtilization(device, last_seen_time_stamp, &sample_val_type, &vgpu_instance_samples_count, &utilization_samples) + check_status(__status__) + return (sample_val_type, vgpu_instance_samples_count, utilization_samples) + + +cpdef tuple device_get_vgpu_process_utilization(intptr_t device, unsigned long long last_seen_time_stamp): + """Retrieves current utilization for processes running on vGPUs on a physical GPU (device). + + 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: + + - unsigned int: Pointer to caller-supplied array size, and returns number of processes running on vGPU instances. + - nvmlVgpuProcessUtilizationSample_t: Pointer to caller-supplied buffer in which vGPU sub process utilization samples are returned. + + .. seealso:: `nvmlDeviceGetVgpuProcessUtilization` + """ + cdef unsigned int vgpu_process_samples_count + cdef nvmlVgpuProcessUtilizationSample_t utilization_samples + with nogil: + __status__ = nvmlDeviceGetVgpuProcessUtilization(device, last_seen_time_stamp, &vgpu_process_samples_count, &utilization_samples) + check_status(__status__) + return (vgpu_process_samples_count, utilization_samples) + + +cpdef int vgpu_instance_get_accounting_mode(unsigned int vgpu_instance) except? -1: + """Queries the state of per process accounting mode on vGPU. + + 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. + + Args: + vgpu_instance (unsigned int): The identifier of the target vGPU instance. + + .. seealso:: `nvmlVgpuInstanceGetAccountingPids` + """ + cdef unsigned int[1] count = [0] + with nogil: + __status__ = nvmlVgpuInstanceGetAccountingPids(vgpu_instance, count, NULL) + check_status_size(__status__) + if count[0] == 0: + return view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] + cdef view.array pids = view.array(shape=(count[0],), itemsize=sizeof(unsigned int), format="I", mode="c") + cdef unsigned int *pids_ptr = (pids.data) + with nogil: + __status__ = nvmlVgpuInstanceGetAccountingPids(vgpu_instance, count, pids_ptr) + check_status(__status__) + return pids + + +cpdef object vgpu_instance_get_accounting_stats(unsigned int vgpu_instance, unsigned int pid) : + """Queries process's accounting stats. + + 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. + + .. 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. + + Args: + vgpu_instance (unsigned int): The identifier of the target vGPU instance. + + .. 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. + + 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. + + 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_ind_ex(unsigned int ind_ex) : + """Acquire the device information for an excluded GPU device, based on its ind_ex. + + Args: + ind_ex (unsigned int): The ind_ex 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(ind_ex, 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. + + 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 activationStatus status. + + .. 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. + + 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_profile_info_v(intptr_t device, unsigned int profile) : + """Versioned wrapper around ``nvmlDeviceGetGpuInstanceProfileInfo`` that accepts a versioned ``nvmlGpuInstanceProfileInfo_v2_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_v2_t: Returns detailed profile information. + + .. seealso:: `nvmlDeviceGetGpuInstanceProfileInfoV` + """ + cdef GpuInstanceProfileInfo_v2 info_py = GpuInstanceProfileInfo_v2() + cdef nvmlGpuInstanceProfileInfo_v2_t *info = (info_py._get_ptr()) + info.version = sizeof(nvmlGpuInstanceProfileInfo_v3_t) | (3 << 24) + with nogil: + __status__ = nvmlDeviceGetGpuInstanceProfileInfoV(device, profile, info) + check_status(__status__) + return info_py + + +cpdef object device_get_gpu_instance_possible_placements_v2(intptr_t device, unsigned int profile_id): + """Get GPU instance placements. + + Args: + device (intptr_t): The identifier of the target device. + profile_id (unsigned int): The GPU instance profile ID. See ``nvmlDeviceGetGpuInstanceProfileInfo``. + + .. 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: + return placements + with nogil: + __status__ = nvmlDeviceGetGpuInstancePossiblePlacements_v2(device, profile_id, placements_ptr, count) + check_status(__status__) + return placements + + +cpdef unsigned int device_get_gpu_instance_remaining_capacity(intptr_t device, unsigned int profile_id) except? 0: + """Get GPU instance profile capacity. + + 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. + + 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, intptr_t placement) except? 0: + """Create GPU instance with the specified placement. + + 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 GpuInstance gpu_instance + with nogil: + __status__ = nvmlDeviceCreateGpuInstanceWithPlacement(device, profile_id, placement, &gpu_instance) + check_status(__status__) + return gpu_instance + + +cpdef gpu_instance_destroy(intptr_t gpu_instance): + """Destroy GPU instance. + + 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. + + 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. + + 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. + + 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 = sizeof(nvmlComputeInstanceProfileInfo_v2_t) | (2 << 24) + 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. + + 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. + + Args: + gpu_instance (intptr_t): The identifier of the target GPU instance. + profile_id (unsigned int): The compute instance profile ID. See ``nvmlGpuInstanceGetComputeInstanceProfileInfo``. + + .. 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: + return placements + with nogil: + __status__ = nvmlGpuInstanceGetComputeInstancePossiblePlacements(gpu_instance, profile_id, placements_ptr, count) + check_status(__status__) + return placements + + +cpdef intptr_t gpu_instance_create_compute_instance(intptr_t gpu_instance, unsigned int profile_id) except? 0: + """Create compute instance. + + 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, intptr_t placement) except? 0: + """Create compute instance with the specified placement. + + 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 ComputeInstance compute_instance + with nogil: + __status__ = nvmlGpuInstanceCreateComputeInstanceWithPlacement(gpu_instance, profile_id, placement, &compute_instance) + check_status(__status__) + return compute_instance + + +cpdef compute_instance_destroy(intptr_t compute_instance): + """Destroy compute instance. + + 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. + + 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. + + 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. + + 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. + + 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. + + 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. + + 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_ind_ex(intptr_t device, unsigned int ind_ex) except? 0: + """Get MIG device handle for the given ind_ex under its parent NVML device. + + Args: + device (intptr_t): Reference to the parent GPU device handle. + ind_ex (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, ind_ex, &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. + + 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 gpm_sample_get(intptr_t device, intptr_t gpm_sample): + """Read a sample of GPM metrics into the provided ``gpm_sample`` buffer. After two samples are gathered, you can call nvmlGpmMetricGet on those samples to retrive metrics. + + Args: + device (intptr_t): Device to get samples for. + gpm_sample (intptr_t): Buffer to read samples into. + + .. seealso:: `nvmlGpmSampleGet` + """ + with nogil: + __status__ = nvmlGpmSampleGet(device, gpm_sample) + check_status(__status__) + + +cpdef gpm_mig_sample_get(intptr_t device, unsigned int gpu_instance_id, intptr_t gpm_sample): + """Read a sample of GPM metrics into the provided ``gpm_sample`` buffer for a MIG GPU Instance. + + Args: + device (intptr_t): Device to get samples for. + gpu_instance_id (unsigned int): MIG GPU Instance ID. + gpm_sample (intptr_t): Buffer to read samples into. + + .. seealso:: `nvmlGpmMigSampleGet` + """ + with nogil: + __status__ = nvmlGpmMigSampleGet(device, gpu_instance_id, gpm_sample) + check_status(__status__) + + +cpdef object gpm_query_device_support(intptr_t device) : + """Indicate whether the supplied device supports GPM. + + Args: + device (intptr_t): NVML device to query for. + + Returns: + nvmlGpmSupport_t: Structure to indicate GPM support ``nvmlGpmSupport_t``. Indicates GPM support per system for the supplied device. + + .. seealso:: `nvmlGpmQueryDeviceSupport` + """ + cdef GpmSupport gpm_support_py = GpmSupport() + cdef nvmlGpmSupport_t *gpm_support = (gpm_support_py._get_ptr()) + gpm_support.version = 1 + with nogil: + __status__ = nvmlGpmQueryDeviceSupport(device, gpm_support) + check_status(__status__) + return gpm_support_py + + +cpdef unsigned int gpm_query_if_streaming_enabled(intptr_t device) except? 0: + """Get GPM stream state. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Returns GPM stream state NVML_FEATURE_DISABLED or NVML_FEATURE_ENABLED. + + .. seealso:: `nvmlGpmQueryIfStreamingEnabled` + """ + cdef unsigned int state + with nogil: + __status__ = nvmlGpmQueryIfStreamingEnabled(device, &state) + check_status(__status__) + return state + + +cpdef gpm_set_streaming_enabled(intptr_t device, unsigned int state): + """Set GPM stream state. + + Args: + device (intptr_t): The identifier of the target device. + state (unsigned int): GPM stream state, NVML_FEATURE_DISABLED or NVML_FEATURE_ENABLED. + + .. seealso:: `nvmlGpmSetStreamingEnabled` + """ + with nogil: + __status__ = nvmlGpmSetStreamingEnabled(device, state) + check_status(__status__) + + +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 DeviceCapabilities_v1 caps_py = DeviceCapabilities_v1() + cdef nvmlDeviceCapabilities_t *caps = (caps_py._get_ptr()) + caps.version = sizeof(nvmlDeviceCapabilities_v1_t) | (1 << 24) + with nogil: + __status__ = nvmlDeviceGetCapabilities(device, caps) + check_status(__status__) + return caps_py + + +cpdef device_workload_power_profile_clear_requested_profiles(intptr_t device, intptr_t requested_profiles): + """Clear Requested Performance Profiles. + + Args: + device (intptr_t): The identifier of the target device. + requested_profiles (intptr_t): Reference to struct ``nvmlWorkloadPowerProfileRequestedProfiles_v1_t``. + + .. seealso:: `nvmlDeviceWorkloadPowerProfileClearRequestedProfiles` + """ + with nogil: + __status__ = nvmlDeviceWorkloadPowerProfileClearRequestedProfiles(device, requested_profiles) + check_status(__status__) + + +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. + + 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. + + 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. + + 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:. + + 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 = sizeof(nvmlDeviceAddressingMode_v1_t) | (1 << 24) + 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. + + 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 = sizeof(nvmlRepairStatus_v1_t) | (1 << 24) + 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. + + 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, intptr_t power_mizer_mode): + """Sets the new power mizer mode. + + 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` + """ + with nogil: + __status__ = nvmlDeviceSetPowerMizerMode_v1(device, power_mizer_mode) + check_status(__status__) + + +cpdef object 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: + nvmlPdi_v1_t: Reference to the caller-provided structure to return the GPU PDI. + + .. seealso:: `nvmlDeviceGetPdi` + """ + cdef Pdi_v1 pdi_py = Pdi_v1() + cdef nvmlPdi_t *pdi = (pdi_py._get_ptr()) + pdi.version = sizeof(nvmlPdi_v1_t) | (1 << 24) + with nogil: + __status__ = nvmlDeviceGetPdi(device, pdi) + check_status(__status__) + return pdi_py + + +cpdef object device_get_nv_link_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_v2 info_py = NvLinkInfo_v2() + cdef nvmlNvLinkInfo_t *info = (info_py._get_ptr()) + info.version = sizeof(nvmlNvLinkInfo_v2_t) | (2 << 24) + with nogil: + __status__ = nvmlDeviceGetNvLinkInfo(device, info) + check_status(__status__) + return info_py + + +cpdef device_read_write_prm_v1(intptr_t device, intptr_t buffer): + """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. + buffer (intptr_t): Structure holding the input data in TLV format as well as the PRM register contents in TLV format (in the case of a successful read operation). Note: the input data and any returned data shall be in network byte order. + + .. seealso:: `nvmlDeviceReadWritePRM_v1` + """ + with nogil: + __status__ = nvmlDeviceReadWritePRM_v1(device, buffer) + 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_v2_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_v2_t: Returns detailed profile information. + + .. seealso:: `nvmlDeviceGetGpuInstanceProfileInfoByIdV` + """ + cdef GpuInstanceProfileInfo_v2 info_py = GpuInstanceProfileInfo_v2() + cdef nvmlGpuInstanceProfileInfo_v2_t *info = (info_py._get_ptr()) + info.version = sizeof(nvmlGpuInstanceProfileInfo_v3_t) | (3 << 24) + with nogil: + __status__ = nvmlDeviceGetGpuInstanceProfileInfoByIdV(device, profile_id, info) + check_status(__status__) + return info_py + + +cpdef object system_get_topology_gpu_set(unsigned int cpuNumber): + """Retrieve the set of GPUs that have a CPU affinity with the given CPU number + + Args: + cpuNumber (unsigned int): The CPU number + + Returns: + array: An array of device handles for GPUs found with affinity to cpuNumber + """ + cdef unsigned int[1] count = [0] + with nogil: + __status__ = nvmlSystemGetTopologyGpuSet(cpuNumber, count, NULL) + check_status_size(__status__) + if count[0] == 0: + return view.array(shape=(1,), itemsize=sizeof(intptr_t), format="i", mode="c")[:0] + cdef view.array deviceArray = view.array(shape=(count[0],), itemsize=sizeof(intptr_t), format="i", mode="c") + with nogil: + __status__ = nvmlSystemGetTopologyGpuSet(cpuNumber, count, deviceArray.data) + check_status(__status__) + return deviceArray + + +cpdef str system_get_driver_branch(): + """Retrieves the driver branch of the NVIDIA driver installed on the system. + + 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 = sizeof(nvmlSystemDriverBranchInfo_v1_t) | (1 << 24) + cdef unsigned int length = 80 + with nogil: + __status__ = nvmlSystemGetDriverBranch(&info, length) + check_status(__status__) + return cpython.PyUnicode_FromString(info.branch) + + +cpdef object unit_get_devices(intptr_t unit): + """Retrieves the set of GPU devices that are attached to the specified unit. + + Args: + unit (Unit): The identifier of the target unit. + + Returns: + array: An array of device handles for GPUs attached to the unit. + """ + cdef unsigned int[1] deviceCount = [0] + with nogil: + __status__ = nvmlUnitGetDevices(unit, deviceCount, NULL) + check_status_size(__status__) + if deviceCount[0] == 0: + return view.array(shape=(1,), itemsize=sizeof(intptr_t), format="i", mode="c")[:0] + cdef view.array deviceArray = view.array(shape=(deviceCount[0],), itemsize=sizeof(intptr_t), format="i", mode="c") + with nogil: + __status__ = nvmlUnitGetDevices(unit, deviceCount, deviceArray.data) + check_status(__status__) + return deviceArray + + +cpdef object device_get_topology_nearest_gpus(intptr_t device, unsigned int level): + """Retrieve the set of GPUs that are nearest to a given device at a specific interconnectivity level + + Args: + device (Device): The identifier of the first device + level (GpuTopologyLevel): The level to search for other GPUs + + Returns: + array: An array of device handles for GPUs found at level + """ + cdef unsigned int[1] count = [0] + with nogil: + __status__ = nvmlDeviceGetTopologyNearestGpus( + device, + level, + count, + NULL + ) + check_status_size(__status__) + if count[0] == 0: + return view.array(shape=(1,), itemsize=sizeof(intptr_t), format="i", mode="c")[:0] + cdef view.array deviceArray = view.array(shape=(deviceCount[0],), itemsize=sizeof(intptr_t), format="i", mode="c") + with nogil: + __status__ = nvmlDeviceGetTopologyNearestGpus( + device, + level, + count, + deviceArray.data + ) + check_status(__status__) + return deviceArray + + +cpdef object 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 + temperature[0].version = sizeof(nvmlTemperature_v1_t) | (1 << 24) + temperature[0].sensorType = sensorType + + with nogil: + __status__ = nvmlDeviceGetTemperatureV(device, temperature) + check_status(__status__) + return temperature.temperature + + +cpdef object device_get_supported_performance_states(intptr_t device, unsigned int size): + """Get all supported Performance States (P-States) for the device. + + Args: + device (Device): The identifier of the target device. + size (unsigned int): The number of states to return. + """ + if size == 0: + return view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] + 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.ptr + + # Get size of array + with nogil: + ptr.version = sizeof(nvmlProcessDetailList_v1_t) | (1 << 24) + 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__) + + +cpdef object device_get_samples(intptr_t device, int type, unsigned long long last_seen_time_stamp): + """Gets recent samples for the GPU. + + Args: + device (intptr_t): The identifier for the target device. + type (SamplingType): Type of sampling event. + last_seen_time_stamp (unsigned long long): Return only samples with timestamp greater than last_seen_time_stamp. + + .. seealso:: `nvmlDeviceGetSamples` + """ + cdef unsigned int[1] sample_count = [0] + cdef unsigned int[1] sample_val_type = [0] + with nogil: + __status__ = nvmlDeviceGetSamples(device, <_SamplingType>type, last_seen_time_stamp, <_ValueType*>sample_val_type, sample_count, NULL) + check_status_size(__status__) + cdef Sample samples = Sample(sample_count[0]) + cdef nvmlSample_t *samples_ptr = samples.ptr + if sample_count[0] == 0: + return samples + with nogil: + __status__ = nvmlDeviceGetSamples(device, <_SamplingType>type, last_seen_time_stamp, <_ValueType*>sample_val_type, sample_count, samples_ptr) + check_status(__status__) + return (sample_val_type[0], samples) + + +cpdef object device_get_retired_pages_v2(intptr_t device, int cause): + """Returns the list of retired pages by source, including pages that are pending retirement + + Args: + device (Device): The identifier of the target device. + cause (PageRetirementCause): Filter page addresses by cause of retirement. + + Returns: + tuple: A tuple of two arrays (addresses, timestamps). + """ + cdef unsigned int[1] page_count = [0] + with nogil: + __status__ = nvmlDeviceGetRetiredPages_v2(device, <_PageRetirementCause>cause, page_count, NULL, NULL) + check_status_size(__status__) + if page_count[0] == 0: + return ( + view.array(shape=(1,), itemsize=sizeof(unsigned long long), format="Q", mode="c")[:0], + view.array(shape=(1,), itemsize=sizeof(unsigned long long), format="Q", mode="c")[:0] + ) + cdef view.array addresses = view.array(shape=(page_count[0],), itemsize=sizeof(unsigned long long), format="Q", mode="c") + cdef view.array timestamps = view.array(shape=(page_count[0],), itemsize=sizeof(unsigned long long), format="Q", mode="c") + with nogil: + __status__ = nvmlDeviceGetRetiredPages_v2(device, <_PageRetirementCause>cause, page_count, addresses.data, timestamps.data) + check_status(__status__) + return (addresses, timestamps) + + +cpdef object device_get_processes_utilization_info(intptr_t device, unsigned long long last_seen_time_stamp): + """Retrieves the recent utilization and process ID for all running processes + + 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.ptr + + # Get size of array + with nogil: + ptr.version = sizeof(nvmlProcessesUtilizationInfo_v1_t) | (1 << 24) + 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) + + +cpdef object device_get_field_values(intptr_t device, FieldValue 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. + + .. seealso:: `nvmlDeviceGetFieldValues` + """ + cdef nvmlFieldValue_t *ptr = values.ptr + cdef unsigned int valuesCount = len(values) + with nogil: + __status__ = nvmlDeviceGetFieldValues(device, valuesCount, ptr) + check_status(__status__) + + return values + + +cpdef object device_clear_field_values(intptr_t device, FieldValue 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 nvmlFieldValue_t *ptr = values.ptr + cdef unsigned int valuesCount = len(values) + + with nogil: + __status__ = nvmlDeviceClearFieldValues(device, valuesCount, ptr) + check_status(__status__) + + +cpdef object device_get_supported_vgpus(intptr_t device): + """Retrieve the supported vGPU types on a physical GPU (device). + + Args: + device (Device): The identifier of the target device. + + Returns: + array: An array of supported vGPU type IDs. + """ + cdef unsigned int[1] vgpuCount = [0] + with nogil: + __status__ = nvmlDeviceGetSupportedVgpus(device, vgpuCount, NULL) + check_status_size(__status__) + if vgpuCount[0] == 0: + return view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] + cdef view.array vgpuTypeIds = view.array(shape=(deviceCount[0],), itemsize=sizeof(unsigned int), format="I", mode="c") + with nogil: + __status__ = nvmlDeviceGetSupportedVgpus(device, vgpuCount, vgpuTypeIds.data) + check_status(__status__) + return vgpuTypeIds + + +cpdef object device_get_creatable_vgpus(intptr_t device): + """Retrieve the currently creatable vGPU types on a physical GPU (device). + + Args: + device (Device): The identifier of the target device. + + Returns: + array: An array of createable vGPU type IDs. + """ + cdef unsigned int[1] vgpuCount = [0] + with nogil: + __status__ = nvmlDeviceGetCreatableVgpus(device, vgpuCount, NULL) + check_status_size(__status__) + if vgpuCount[0] == 0: + return view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] + cdef view.array vgpuTypeIds = view.array(shape=(deviceCount[0],), itemsize=sizeof(unsigned int), format="I", mode="c") + with nogil: + __status__ = nvmlDeviceGetCreatableVgpus(device, vgpuCount, vgpuTypeIds.data) + check_status(__status__) + return vgpuTypeIds + + +cpdef object device_get_active_vgpus(intptr_t device): + """Retrieve the active vGPU instances on a device. + + Args: + device (Device): The identifier of the target device. + + Returns: + array: An array of active vGPU instance IDs. + """ + cdef unsigned int[1] vgpuCount = [0] + with nogil: + __status__ = nvmlDeviceGetActiveVgpus(device, vgpuCount, NULL) + check_status_size(__status__) + if vgpuCount[0] == 0: + return view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] + cdef view.array vgpuInstances = view.array(shape=(deviceCount[0],), itemsize=sizeof(unsigned int), format="I", mode="c") + with nogil: + __status__ = nvmlDeviceGetActiveVgpus(device, vgpuCount, vgpuInstances.data) + check_status(__status__) + return vgpuInstances + + +cpdef str vgpu_instance_get_vm_id(unsigned int vgpu_instance): + """Retrieve the VM ID associated with a vGPU instance. + + Args: + vgpu_instance (unsigned int): The identifier of the target vGPU instance. + + Returns: + tuple[str, VgpuVmIdType]: A tuple of (id, id_type). + """ + cdef unsigned int size = 80 + cdef char[80] vmId + cdef nvmlVgpuVmIdType_t[1] vmIdType + with nogil: + __status__ = nvmlVgpuInstanceGetVmID(vgpu_instance, vmId, size, vmIdType) + check_status(__status__) + return (cpython.PyUnicode_FromString(vmId), vmIdType[0]) + + +cpdef object gpu_instance_get_creatable_vgpus(intptr_t gpu_instance): + """Query the currently creatable vGPU types on a specific GPU Instance. + + 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.ptr + + # Get size of array + with nogil: + ptr.version = sizeof(nvmlVgpuTypeIdInfo_v1_t) | (1 << 24) + 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.ptr + + with nogil: + ptr.version = sizeof(nvmlActiveVgpuInstanceInfo_v1_t) | (1 << 24) + 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.ptr + + # Get size of array + with nogil: + ptr.version = sizeof(nvmlVgpuCreatablePlacementInfo_v1_t) | (1 << 24) + ptr.count = 0 + ptr.placementIds = NULL + __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.ptr + + # Get size of array + with nogil: + ptr.version = sizeof(nvmlVgpuPlacementList_v2_t) | (2 << 24) + 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.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.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.ptr + cdef nvmlVgpuMetadata_t *vgpu_metadata_ptr = vgpu_metadata.ptr + cdef nvmlVgpuPgpuMetadata_t *pgpu_metadata_ptr = pgpu_metadata.ptr + + with nogil: + __status__ = nvmlGetVgpuCompatibility(vgpu_metadata_ptr, pgpu_metadata_ptr, ptr) + check_status(__status__) + + return compatibilityInfo + + +cpdef tuple get_vgpu_version(): + """Query the ranges of supported vGPU versions. + + Returns: + tuple: A tuple of (VgpuVersion supported, VgpuVersion current). + """ + cdef VgpuVersion supported = VgpuVersion() + cdef nvmlVgpuVersion_t *supported_ptr = supported.ptr + cdef VgpuVersion current = VgpuVersion() + cdef nvmlVgpuVersion_t *current_ptr = current.ptr + + with nogil: + __status__ = nvmlGetVgpuVersion(supported_ptr, current_ptr) + + check_status(__status__) + return (supported, current) + + +cpdef object device_get_vgpu_instances_utilization_info(intptr_t device): + """ + Retrieves recent utilization for vGPU instances running on a physical GPU (device). + + 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.ptr + + with nogil: + ptr.version = sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t) | (1 << 24) + 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.ptr + + with nogil: + ptr.version = sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t) | (1 << 24) + 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_gpu_instances(intptr_t device, unsigned int profile_id): + """Get GPU instances for given profile ID. + + Args: + device (Device): The identifier of the target device. + profile_id (unsigned int): The GPU instance profile ID. See device_get_gpu_instance_profile_info(). + + Returns: + array: An array of GPU instance handles. + """ + cdef unsigned int[1] count = [0] + with nogil: + __status__ = nvmlDeviceGetGpuInstances(device, profile_id, NULL, count) + check_status_size(__status__) + + if count[0] == 0: + view.array(shape=(1,), itemsize=sizeof(intptr_t), format="i", mode="c")[:0] + + cdef view.array gpuInstances = view.array(shape=(count[0],), itemsize=sizeof(intptr_t), format="i", mode="c") + with nogil: + __status__ = nvmlDeviceGetGpuInstances(device, profile_id, gpuInstances.data, count) + check_status(__status__) + + return gpuInstances + + +cpdef object gpu_instance_get_compute_instances(intptr_t gpu_instance, unsigned int profile_id): + """Get Compute instances for given profile ID. + + Args: + gpu_instance (GpuInstance): The identifier of the target GPU Instance. + profile_id (unsigned int): The Compute instance profile ID. + + Returns: + array: An array of Compute instance handles. + """ + cdef unsigned int[1] count = [0] + with nogil: + __status__ = nvmlGpuInstanceGetComputeInstances(gpu_instance, profile_id, NULL, count) + check_status_size(__status__) + + if count[0] == 0: + view.array(shape=(1,), itemsize=sizeof(intptr_t), format="i", mode="c")[:0] + + cdef view.array computeInstances = view.array(shape=(count[0],), itemsize=sizeof(intptr_t), format="i", mode="c") + with nogil: + __status__ = nvmlGpuInstanceGetComputeInstances(gpu_instance, profile_id, computeInstances.data, count) + check_status(__status__) + + return computeInstances + + +cpdef object device_get_sram_unique_uncorrected_ecc_error_counts(intptr_t device): + """Retrieves the counts of SRAM unique uncorrected ECC errors + + 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.ptr + + with nogil: + ptr.version = sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t) | (1 << 24) + 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_graphics_running_processes_v3(intptr_t device): + """Get information about processes with a graphics context on a device. + + Args: + device (intptr_t): The device handle or MIG device handle. + + .. 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.ptr + if info_count[0] == 0: + return infos + + # TODO: This isn't well behaved and seems to corrupt memory + + with nogil: + + # __status__ = nvmlDeviceGetGraphicsRunningProcesses_v3(device, info_count, infos_ptr) + pass + # check_status(__status__) + return infos diff --git a/cuda_bindings/tests/nvml/README.md b/cuda_bindings/tests/nvml/README.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cuda_bindings/tests/nvml/__init__.py b/cuda_bindings/tests/nvml/__init__.py new file mode 100644 index 0000000000..830c1bf0de --- /dev/null +++ b/cuda_bindings/tests/nvml/__init__.py @@ -0,0 +1,2 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE diff --git a/cuda_bindings/tests/nvml/conftest.py b/cuda_bindings/tests/nvml/conftest.py new file mode 100644 index 0000000000..43b241f81a --- /dev/null +++ b/cuda_bindings/tests/nvml/conftest.py @@ -0,0 +1,118 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE + +import platform +from collections import namedtuple + +import pytest +from cuda.bindings import nvml + + +class NVMLInitializer: + def __init__(self): + pass + + def __enter__(self): + nvml.init_v2() + + def __exit__(self, exception_type, exception, trace): + nvml.shutdown() + + +# TODO: Unify these with the rest of the cuda_bindings suite + + +current_os = platform.system() +if current_os == "VMkernel": + current_os = "Linux" # Treat VMkernel as Linux + + +def is_windows(os=current_os): + return os == "Windows" + + +def is_linux(os=current_os): + return os == "Linux" + + +def is_vgpu(device): + """ + Returns True if device in vGPU virtualization mode + """ + return nvml.device_get_virtualization_mode(device) == nvml.GpuVirtualizationMode.GPU_VIRTUALIZATION_MODE_VGPU + + +def dev_supports_ecc(device): + try: + (cur_ecc, pend_ecc) = nvml.device_get_ecc_mode(device) + return cur_ecc != nvml.Feature.FEATURE_DISABLED + except nvml.NotSupportedError as e: + return False + + +def get_brand_name(device: int) -> str: + brand_code = nvml.device_get_brand(device) + brand_name = nvml.BrandType.to_string(brand_code) + brand_name = brand_name.replace("BRAND_", "").replace("_", " ") + return brand_name + + +@pytest.fixture(scope="session", autouse=True) +def device_info(): + dev_count = None + bus_id_to_board_details = {} + + with NVMLInitializer(): + dev_count = nvml.device_get_count_v2() + + # Store some details for each device now when we know NVML is in known state + for i in range(dev_count): + try: + dev = nvml.device_get_handle_by_index_v2(i) + except nvml.NoPermissionError: + continue + pci_info = nvml.device_get_pci_info_v3(dev) + + name = nvml.device_get_name(dev) + # Get architecture name ex: Ampere, Kepler + arch_id = nvml.device_get_architecture(dev) + # 1 = NVML_DEVICE_ARCH_KEPLER and 12 = NVML_DEVICE_ARCH_COUNT + assert 1 <= arch_id <= 12, "Architecture not found, presumably something newer" + # arch_name = (utils.nvml_architecture_name.get(archID)).split("_")[-1] + # archName = archName[0] + archName[1:].lower() + + BoardCfg = namedtuple("BoardCfg", "name, ids_arr") + board = BoardCfg(name, ids_arr=[(pci_info.pci_device_id, pci_info.pci_sub_system_id)]) + + try: + serial = nvml.device_get_serial(dev) + except: + serial = None + + bus_id = pci_info.bus_id + device_id = pci_info.device_ + uuid = nvml.device_get_uuid(dev) + + BoardDetails = namedtuple("BoardDetails", "name, board, arch_id, bus_id, device_id, serial") + bus_id_to_board_details[uuid] = BoardDetails(name, board, arch_id, bus_id, device_id, serial) + + return bus_id_to_board_details + + +def get_devices(device_info): + for uuid in list(device_info.keys()): + try: + yield nvml.device_get_handle_by_uuid(uuid) + except nvml.NoPermissionError: + continue # ignore devices that can't be accessed + + +@pytest.fixture +def for_all_devices(device_info): + with NVMLInitializer(): + unique_devices = set() + for device_id in get_devices(device_info): + if device_id not in unique_devices: + unique_devices.add(device_id) + yield device_id + # RestoreDefaultEnvironment.restore() diff --git a/cuda_bindings/tests/nvml/test_compute_mode.py b/cuda_bindings/tests/nvml/test_compute_mode.py new file mode 100644 index 0000000000..7bb450ab31 --- /dev/null +++ b/cuda_bindings/tests/nvml/test_compute_mode.py @@ -0,0 +1,25 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE + +import pytest +from cuda.bindings import nvml + +COMPUTE_MODES = [ + nvml.ComputeMode.COMPUTEMODE_DEFAULT, + nvml.ComputeMode.COMPUTEMODE_PROHIBITED, + nvml.ComputeMode.COMPUTEMODE_EXCLUSIVE_PROCESS, +] + + +def test_compute_mode_supported_nonroot(for_all_devices): + device = for_all_devices + + try: + original_compute_mode = nvml.device_get_compute_mode(device) + except nvml.NotSupportedError: + pytest.skip("nvmlDeviceGetComputeMode not supported") + + for cm in COMPUTE_MODES: + with pytest.raises(nvml.NoPermissionError): + nvml.device_set_compute_mode(device, cm) + assert original_compute_mode == nvml.device_get_compute_mode(device), "Compute mode shouldn't have changed" diff --git a/cuda_bindings/tests/nvml/test_cuda.py b/cuda_bindings/tests/nvml/test_cuda.py new file mode 100644 index 0000000000..71a4777e66 --- /dev/null +++ b/cuda_bindings/tests/nvml/test_cuda.py @@ -0,0 +1,69 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE + +import cuda.bindings.driver as cuda +from cuda.bindings import nvml + +from .conftest import NVMLInitializer + + +def get_nvml_device_names(): + result = [] + with NVMLInitializer(): + # uses NVML Library to get the device count, device id and device pci id + num_devices = nvml.device_get_count_v2() + for idx in range(num_devices): + handle = nvml.device_get_handle_by_index_v2(idx) + name = nvml.device_get_name(handle) + info = nvml.device_get_pci_info_v3(handle) + assert isinstance(info.bus, int) + assert isinstance(name, str) + result.append({"name": name, "id": info.bus}) + + return result + + +def get_cuda_device_names(sort_by_bus_id=True): + result = [] + + (err,) = cuda.cuInit(0) + assert err == cuda.CUresult.CUDA_SUCCESS + + err, device_count = cuda.cuDeviceGetCount() + assert err == cuda.CUresult.CUDA_SUCCESS + + for dev in range(device_count): + size = 256 + err, name = cuda.cuDeviceGetName(size, dev) + name = name.split(b"\x00")[0].decode() + assert err == cuda.CUresult.CUDA_SUCCESS + + err, pci_bus_id = cuda.cuDeviceGetAttribute(cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, dev) + assert err == cuda.CUresult.CUDA_SUCCESS + assert isinstance(pci_bus_id, int) + + result.append({"name": name, "id": pci_bus_id}) + + if sort_by_bus_id: + result = sorted(result, key=lambda k: k["id"]) + + return result + + +def test_cuda_device_order(): + # TODO: + + # if not utils.is_cuda_supported_system(): + # test_utils.skip_test("Cuda is not supported on this system") + + # CUDA is enabled on 1:1 vGPUs of Maxwell and all Pascal vGPUs. + # Skip the test for not supported CUDA vGPU profiles + # for device in test_utils.get_devices(): + # if device.feature_dict.is_vgpu_device: + # if not device.feature_dict.is_vgpu_cuda_supported: + # test_utils.skip_test("CUDA not supported on this vGPU device") + + cuda_devices = get_cuda_device_names() + nvml_devices = get_nvml_device_names() + + assert cuda_devices == nvml_devices, "CUDA and NVML device lists do not match" From 55e0fc9f99bcc8fdbf3a2204c7f847cd641928d6 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Mon, 24 Nov 2025 18:32:08 -0500 Subject: [PATCH 2/9] More tests --- cuda_bindings/cuda/bindings/nvml.pxd | 6 +- cuda_bindings/cuda/bindings/nvml.pyx | 376 +++++++++++++++++++++++++- cuda_bindings/tests/nvml/conftest.py | 41 +-- cuda_bindings/tests/nvml/test_cuda.py | 12 - cuda_bindings/tests/nvml/test_gpu.py | 40 +++ cuda_bindings/tests/nvml/test_init.py | 50 ++++ cuda_bindings/tests/nvml/util.py | 40 +++ 7 files changed, 513 insertions(+), 52 deletions(-) create mode 100644 cuda_bindings/tests/nvml/test_gpu.py create mode 100644 cuda_bindings/tests/nvml/test_init.py create mode 100644 cuda_bindings/tests/nvml/util.py diff --git a/cuda_bindings/cuda/bindings/nvml.pxd b/cuda_bindings/cuda/bindings/nvml.pxd index 4dcab7ff94..590ab3758b 100644 --- a/cuda_bindings/cuda/bindings/nvml.pxd +++ b/cuda_bindings/cuda/bindings/nvml.pxd @@ -125,6 +125,10 @@ ctypedef nvmlPowerProfileType_t _PowerProfileType ctypedef nvmlDeviceAddressingModeType_t _DeviceAddressingModeType + + + + ############################################################################### # Functions ############################################################################### @@ -155,7 +159,7 @@ cpdef intptr_t device_get_handle_by_uuidv(intptr_t uuid) except? 0 cpdef intptr_t device_get_handle_by_pci_bus_id_v2(pci_bus_id) except? 0 cpdef str device_get_name(intptr_t device) cpdef int device_get_brand(intptr_t device) except? -1 -cpdef unsigned int device_get_ind_ex(intptr_t device) except? 0 +cpdef unsigned int device_get_index(intptr_t device) except? 0 cpdef str device_get_serial(intptr_t device) cpdef unsigned int device_get_module_id(intptr_t device) except? 0 cpdef object device_get_c2c_mode_info_v(intptr_t device) diff --git a/cuda_bindings/cuda/bindings/nvml.pyx b/cuda_bindings/cuda/bindings/nvml.pyx index ab4bb1376c..0bed1ed246 100644 --- a/cuda_bindings/cuda/bindings/nvml.pyx +++ b/cuda_bindings/cuda/bindings/nvml.pyx @@ -752,6 +752,378 @@ class DeviceAddressingModeType(_IntEnum): DEVICE_ADDRESSING_MODE_HMM = NVML_DEVICE_ADDRESSING_MODE_HMM DEVICE_ADDRESSING_MODE_ATS = NVML_DEVICE_ADDRESSING_MODE_ATS + +class FI(_IntEnum): + 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 = DEV_PERF_POLICY_POWER # Throttling to not exceed currently set power limits in ns + DEV_CLOCKS_EVENT_REASON_SYNC_BOOST = DEV_PERF_POLICY_SYNC_BOOST # 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 + MAX = 274 # One greater than the largest field ID defined above + + ############################################################################### # Error handling ############################################################################### @@ -18130,7 +18502,7 @@ cpdef int device_get_brand(intptr_t device) except? -1: return type -cpdef unsigned int device_get_ind_ex(intptr_t device) except? 0: +cpdef unsigned int device_get_index(intptr_t device) except? 0: """Retrieves the NVML index of this device. Args: @@ -23679,7 +24051,7 @@ cpdef str device_get_hostname_v1(intptr_t device): return cpython.PyUnicode_FromString(hostname.value) -cpdef object device_get_field_values(intptr_t device, FieldValue 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: diff --git a/cuda_bindings/tests/nvml/conftest.py b/cuda_bindings/tests/nvml/conftest.py index 43b241f81a..2f07d97151 100644 --- a/cuda_bindings/tests/nvml/conftest.py +++ b/cuda_bindings/tests/nvml/conftest.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE -import platform from collections import namedtuple import pytest @@ -19,42 +18,10 @@ def __exit__(self, exception_type, exception, trace): nvml.shutdown() -# TODO: Unify these with the rest of the cuda_bindings suite - - -current_os = platform.system() -if current_os == "VMkernel": - current_os = "Linux" # Treat VMkernel as Linux - - -def is_windows(os=current_os): - return os == "Windows" - - -def is_linux(os=current_os): - return os == "Linux" - - -def is_vgpu(device): - """ - Returns True if device in vGPU virtualization mode - """ - return nvml.device_get_virtualization_mode(device) == nvml.GpuVirtualizationMode.GPU_VIRTUALIZATION_MODE_VGPU - - -def dev_supports_ecc(device): - try: - (cur_ecc, pend_ecc) = nvml.device_get_ecc_mode(device) - return cur_ecc != nvml.Feature.FEATURE_DISABLED - except nvml.NotSupportedError as e: - return False - - -def get_brand_name(device: int) -> str: - brand_code = nvml.device_get_brand(device) - brand_name = nvml.BrandType.to_string(brand_code) - brand_name = brand_name.replace("BRAND_", "").replace("_", " ") - return brand_name +@pytest.fixture +def nvml_init(): + with NVMLInitializer(): + yield @pytest.fixture(scope="session", autouse=True) diff --git a/cuda_bindings/tests/nvml/test_cuda.py b/cuda_bindings/tests/nvml/test_cuda.py index 71a4777e66..95c62e0879 100644 --- a/cuda_bindings/tests/nvml/test_cuda.py +++ b/cuda_bindings/tests/nvml/test_cuda.py @@ -51,18 +51,6 @@ def get_cuda_device_names(sort_by_bus_id=True): def test_cuda_device_order(): - # TODO: - - # if not utils.is_cuda_supported_system(): - # test_utils.skip_test("Cuda is not supported on this system") - - # CUDA is enabled on 1:1 vGPUs of Maxwell and all Pascal vGPUs. - # Skip the test for not supported CUDA vGPU profiles - # for device in test_utils.get_devices(): - # if device.feature_dict.is_vgpu_device: - # if not device.feature_dict.is_vgpu_cuda_supported: - # test_utils.skip_test("CUDA not supported on this vGPU device") - cuda_devices = get_cuda_device_names() nvml_devices = get_nvml_device_names() diff --git a/cuda_bindings/tests/nvml/test_gpu.py b/cuda_bindings/tests/nvml/test_gpu.py new file mode 100644 index 0000000000..5a227d03d1 --- /dev/null +++ b/cuda_bindings/tests/nvml/test_gpu.py @@ -0,0 +1,40 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE + +import pytest +from cuda.bindings import nvml + +from . import util + + +def test_gpu_get_module_id(nvml_init): + # Unique module IDs cannot exceed the number of GPUs on the system + device_count = nvml.device_get_count_v2() + + for i in range(device_count): + device = nvml.device_get_handle_by_index_v2(i) + uuid = nvml.device_get_uuid(device) + + if util.is_vgpu(device): + continue + + module_id = nvml.device_get_module_id(device) + assert isinstance(module_id, int) + + +def test_gpu_get_platform_info(for_all_devices): + device = for_all_devices + + if util.is_vgpu(device): + pytest.skip("Not supported on vGPU device") + + # TODO + # if device.feature_dict.board.chip < board_class.Architecture.Blackwell: + # test_utils.skip_test("Not supported on chip before Blackwell") + + try: + platform_info = nvml.device_get_platform_info(device) + except nvml.NotSupportedError: + pytest.skip("Not supported returned, likely NVLink is disabled.") + + assert isinstance(platform_info, nvml.PlatformInfo_v2) diff --git a/cuda_bindings/tests/nvml/test_init.py b/cuda_bindings/tests/nvml/test_init.py new file mode 100644 index 0000000000..b63aa7bbbe --- /dev/null +++ b/cuda_bindings/tests/nvml/test_init.py @@ -0,0 +1,50 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE + +import pytest +from cuda.bindings import nvml + + +def assert_nvml_is_initialized(): + assert nvml.device_get_count_v2() > 0 + + +def assert_nvml_is_uninitialized(): + with pytest.raises(nvml.UninitializedError): + nvml.device_get_count_v2() + + +def test_init_ref_count(): + """ + Verifies that we can call NVML shutdown and init(2) multiple times, and that ref counting works + """ + with pytest.raises(nvml.UninitializedError): + nvml.shutdown() + + assert_nvml_is_uninitialized() + + for i in range(3): + # Init 5 times + for j in range(5): + nvml.init_v2() + assert_nvml_is_initialized() + + # Shutdown 4 times, NVML should remain initailized + for j in range(4): + nvml.shutdown() + assert_nvml_is_initialized() + + # Shutdown the final time + nvml.shutdown() + assert_nvml_is_uninitialized() + + +def test_init_check_index(nvml_init): + """ + Verifies that the index from nvmlDeviceGetIndex is correct + """ + dev_count = nvml.device_get_count_v2() + for idx in range(dev_count): + handle = nvml.device_get_handle_by_index_v2(idx) + # Verify that the index matches + assert idx == nvml.device_get_index(handle) diff --git a/cuda_bindings/tests/nvml/util.py b/cuda_bindings/tests/nvml/util.py new file mode 100644 index 0000000000..00154330a7 --- /dev/null +++ b/cuda_bindings/tests/nvml/util.py @@ -0,0 +1,40 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE + + +import platform + +from cuda.bindings import nvml + +current_os = platform.system() +if current_os == "VMkernel": + current_os = "Linux" # Treat VMkernel as Linux + + +def is_windows(os=current_os): + return os == "Windows" + + +def is_linux(os=current_os): + return os == "Linux" + + +def is_vgpu(device): + """ + Returns True if device in vGPU virtualization mode + """ + return nvml.device_get_virtualization_mode(device) == nvml.GpuVirtualizationMode.VGPU + + +def supports_ecc(device): + try: + (cur_ecc, pend_ecc) = nvml.device_get_ecc_mode(device) + return cur_ecc != nvml.Feature.FEATURE_DISABLED + except nvml.NotSupportedError as e: + return False + + +def supports_nvlink(device): + fields = nvml.FieldValue(1) + fields[0].field_id = nvml.FI.DEV_NVLINK_GET_STATE + return nvml.device_get_field_values(device, fields)[0].nvml_return == nvml.Return.SUCCESS From ac41b4259933b9a35b355db7552d7bb98167826d Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Mon, 24 Nov 2025 21:56:37 -0500 Subject: [PATCH 3/9] More tests --- cuda_bindings/cuda/bindings/nvml.pxd | 10 +-- cuda_bindings/cuda/bindings/nvml.pyx | 69 ++++++++++++------- cuda_bindings/tests/nvml/test_nvlink.py | 30 ++++++++ .../tests/nvml/test_page_retirement.py | 61 ++++++++++++++++ cuda_bindings/tests/nvml/util.py | 2 +- 5 files changed, 140 insertions(+), 32 deletions(-) create mode 100644 cuda_bindings/tests/nvml/test_nvlink.py create mode 100644 cuda_bindings/tests/nvml/test_page_retirement.py diff --git a/cuda_bindings/cuda/bindings/nvml.pxd b/cuda_bindings/cuda/bindings/nvml.pxd index 590ab3758b..bb61cf9229 100644 --- a/cuda_bindings/cuda/bindings/nvml.pxd +++ b/cuda_bindings/cuda/bindings/nvml.pxd @@ -125,10 +125,6 @@ ctypedef nvmlPowerProfileType_t _PowerProfileType ctypedef nvmlDeviceAddressingModeType_t _DeviceAddressingModeType - - - - ############################################################################### # Functions ############################################################################### @@ -144,7 +140,7 @@ cpdef int system_get_cuda_driver_version_v2() except 0 cpdef str system_get_process_name(unsigned int pid) cpdef object system_get_hic_version() cpdef unsigned int unit_get_count() except? 0 -cpdef intptr_t unit_get_handle_by_ind_ex(unsigned int ind_ex) except? 0 +cpdef intptr_t unit_get_handle_by_index(unsigned int ind_ex) except? 0 cpdef object unit_get_unit_info(intptr_t unit) cpdef object unit_get_led_state(intptr_t unit) cpdef object unit_get_psu_info(intptr_t unit) @@ -406,7 +402,7 @@ cpdef object vgpu_instance_get_accounting_stats(unsigned int vgpu_instance, unsi cpdef vgpu_instance_clear_accounting_pids(unsigned int vgpu_instance) cpdef object vgpu_instance_get_license_info_v2(unsigned int vgpu_instance) cpdef unsigned int get_excluded_device_count() except? 0 -cpdef object get_excluded_device_info_by_ind_ex(unsigned int ind_ex) +cpdef object get_excluded_device_info_by_index(unsigned int ind_ex) cpdef int device_set_mig_mode(intptr_t device, unsigned int mode) except? -1 cpdef tuple device_get_mig_mode(intptr_t device) cpdef object device_get_gpu_instance_profile_info_v(intptr_t device, unsigned int profile) @@ -429,7 +425,7 @@ cpdef unsigned int device_is_mig_device_handle(intptr_t device) except? 0 cpdef unsigned int device_get_gpu_instance_id(intptr_t device) except? 0 cpdef unsigned int device_get_compute_instance_id(intptr_t device) except? 0 cpdef unsigned int device_get_max_mig_device_count(intptr_t device) except? 0 -cpdef intptr_t device_get_mig_device_handle_by_ind_ex(intptr_t device, unsigned int ind_ex) except? 0 +cpdef intptr_t device_get_mig_device_handle_by_index(intptr_t device, unsigned int ind_ex) except? 0 cpdef intptr_t device_get_device_handle_from_mig_device_handle(intptr_t mig_device) except? 0 cpdef gpm_sample_get(intptr_t device, intptr_t gpm_sample) cpdef gpm_mig_sample_get(intptr_t device, unsigned int gpu_instance_id, intptr_t gpm_sample) diff --git a/cuda_bindings/cuda/bindings/nvml.pyx b/cuda_bindings/cuda/bindings/nvml.pyx index 0bed1ed246..e89e82ccee 100644 --- a/cuda_bindings/cuda/bindings/nvml.pyx +++ b/cuda_bindings/cuda/bindings/nvml.pyx @@ -1124,6 +1124,9 @@ class FI(_IntEnum): MAX = 274 # One greater than the largest field ID defined above +NVLINK_MAX_LINKS = 18 + + ############################################################################### # Error handling ############################################################################### @@ -18219,7 +18222,7 @@ cpdef unsigned int unit_get_count() except? 0: return unit_count -cpdef intptr_t unit_get_handle_by_ind_ex(unsigned int ind_ex) except? 0: +cpdef intptr_t unit_get_handle_by_index(unsigned int ind_ex) except? 0: """Acquire the handle for a particular unit, based on its ind_ex. Args: @@ -22972,7 +22975,7 @@ cpdef unsigned int get_excluded_device_count() except? 0: return device_count -cpdef object get_excluded_device_info_by_ind_ex(unsigned int ind_ex) : +cpdef object get_excluded_device_info_by_index(unsigned int ind_ex) : """Acquire the device information for an excluded GPU device, based on its ind_ex. Args: @@ -23411,7 +23414,7 @@ cpdef unsigned int device_get_max_mig_device_count(intptr_t device) except? 0: return count -cpdef intptr_t device_get_mig_device_handle_by_ind_ex(intptr_t device, unsigned int ind_ex) except? 0: +cpdef intptr_t device_get_mig_device_handle_by_index(intptr_t device, unsigned int ind_ex) except? 0: """Get MIG device handle for the given ind_ex under its parent NVML device. Args: @@ -23901,7 +23904,7 @@ cpdef object device_get_running_process_detail_list(intptr_t device, unsigned in """ cdef ProcessDetailList_v1 plist = ProcessDetailList_v1() - cdef nvmlProcessDetailList_v1_t *ptr = plist.ptr + cdef nvmlProcessDetailList_v1_t *ptr = plist._get_ptr() # Get size of array with nogil: @@ -23939,7 +23942,7 @@ cpdef object device_get_samples(intptr_t device, int type, unsigned long long la __status__ = nvmlDeviceGetSamples(device, <_SamplingType>type, last_seen_time_stamp, <_ValueType*>sample_val_type, sample_count, NULL) check_status_size(__status__) cdef Sample samples = Sample(sample_count[0]) - cdef nvmlSample_t *samples_ptr = samples.ptr + cdef nvmlSample_t *samples_ptr = samples._get_ptr() if sample_count[0] == 0: return samples with nogil: @@ -23988,7 +23991,7 @@ cpdef object device_get_processes_utilization_info(intptr_t device, unsigned lon ProcessesUtilizationInfo_v1: The processes utilization information structure. """ cdef ProcessesUtilizationInfo_v1 procesesUtilInfo = ProcessesUtilizationInfo_v1() - cdef nvmlProcessesUtilizationInfo_t *ptr = procesesUtilInfo.ptr + cdef nvmlProcessesUtilizationInfo_t *ptr = procesesUtilInfo._get_ptr() # Get size of array with nogil: @@ -24051,6 +24054,22 @@ cpdef str device_get_hostname_v1(intptr_t device): return cpython.PyUnicode_FromString(hostname.value) +cdef FieldValue _cast_field_values(values): + cdef FieldValue values_ + cdef unsigned int valuesCount = len(values) + if isinstance(values, FieldValue): + values_ = values + else: + values_ = FieldValue(valuesCount) + for i, v in enumerate(values): + if isinstance(v, tuple): + values_[i].field_id = v[0] + values_[i].scope_id = v[1] + else: + values_[i].field_id = v + 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. @@ -24060,16 +24079,17 @@ cpdef object device_get_field_values(intptr_t device, values): .. seealso:: `nvmlDeviceGetFieldValues` """ - cdef nvmlFieldValue_t *ptr = values.ptr + cdef FieldValue values_ = _cast_field_values(values) + cdef nvmlFieldValue_t *ptr = values_._get_ptr() cdef unsigned int valuesCount = len(values) with nogil: __status__ = nvmlDeviceGetFieldValues(device, valuesCount, ptr) check_status(__status__) - return values + return values_ -cpdef object device_clear_field_values(intptr_t device, FieldValue values): +cpdef object 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: @@ -24077,7 +24097,8 @@ cpdef object device_clear_field_values(intptr_t device, FieldValue values): values (FieldValue): FieldValue instance to hold field values. Each value's fieldId must be populated prior to this call """ - cdef nvmlFieldValue_t *ptr = values.ptr + cdef FieldValue values_ = _cast_field_values(values) + cdef nvmlFieldValue_t *ptr = values_._get_ptr() cdef unsigned int valuesCount = len(values) with nogil: @@ -24180,7 +24201,7 @@ cpdef object gpu_instance_get_creatable_vgpus(intptr_t gpu_instance): """ cdef VgpuTypeIdInfo_v1 pVgpus = VgpuTypeIdInfo_v1() - cdef nvmlVgpuTypeIdInfo_v1_t *ptr = pVgpus.ptr + cdef nvmlVgpuTypeIdInfo_v1_t *ptr = pVgpus._get_ptr() # Get size of array with nogil: @@ -24213,7 +24234,7 @@ cpdef object gpu_instance_get_active_vgpus(intptr_t gpu_instance): ActiveVgpuInstanceInfo: The vGPU instance ID information structure. """ cdef ActiveVgpuInstanceInfo_v1 activeVgpuInfo = ActiveVgpuInstanceInfo_v1() - cdef nvmlActiveVgpuInstanceInfo_v1_t *ptr = activeVgpuInfo.ptr + cdef nvmlActiveVgpuInstanceInfo_v1_t *ptr = activeVgpuInfo._get_ptr() with nogil: ptr.version = sizeof(nvmlActiveVgpuInstanceInfo_v1_t) | (1 << 24) @@ -24247,7 +24268,7 @@ cpdef object gpu_instance_get_vgpu_type_creatable_placements(intptr_t gpu_instan """ cdef VgpuCreatablePlacementInfo_v1 pCreatablePlacementInfo = VgpuCreatablePlacementInfo_v1() - cdef nvmlVgpuCreatablePlacementInfo_v1_t *ptr = pCreatablePlacementInfo.ptr + cdef nvmlVgpuCreatablePlacementInfo_v1_t *ptr = pCreatablePlacementInfo._get_ptr() # Get size of array with nogil: @@ -24283,7 +24304,7 @@ cpdef object device_get_vgpu_type_creatable_placements(intptr_t device, unsigned """ cdef VgpuPlacementList_v2 pPlacementList = VgpuPlacementList_v2() - cdef nvmlVgpuPlacementList_v2_t *ptr = pPlacementList.ptr + cdef nvmlVgpuPlacementList_v2_t *ptr = pPlacementList._get_ptr() # Get size of array with nogil: @@ -24320,7 +24341,7 @@ cpdef object vgpu_instance_get_metadata(unsigned int vgpu_instance): """ cdef VgpuMetadata vgpuMetadata = VgpuMetadata() cdef unsigned int[1] bufferSize = [sizeof(nvmlVgpuMetadata_t)] - cdef nvmlVgpuMetadata_t *ptr = vgpuMetadata.ptr + cdef nvmlVgpuMetadata_t *ptr = vgpuMetadata._get_ptr() with nogil: __status__ = nvmlVgpuInstanceGetMetadata(vgpu_instance, ptr, bufferSize) @@ -24342,7 +24363,7 @@ cpdef object device_get_vgpu_metadata(intptr_t device): """ cdef VgpuPgpuMetadata pgpuMetadata = VgpuPgpuMetadata() cdef unsigned int[1] bufferSize = [sizeof(nvmlVgpuPgpuMetadata_t)] - cdef nvmlVgpuPgpuMetadata_t *ptr = pgpuMetadata.ptr + cdef nvmlVgpuPgpuMetadata_t *ptr = pgpuMetadata._get_ptr() with nogil: __status__ = nvmlDeviceGetVgpuMetadata(device, ptr, bufferSize) @@ -24364,9 +24385,9 @@ cpdef object get_vgpu_compatibility(VgpuMetadata vgpu_metadata, VgpuPgpuMetadata VgpuPgpuCompatibility: Compatibility information. """ cdef VgpuPgpuCompatibility compatibilityInfo = VgpuPgpuCompatibility() - cdef nvmlVgpuPgpuCompatibility_t *ptr = compatibilityInfo.ptr - cdef nvmlVgpuMetadata_t *vgpu_metadata_ptr = vgpu_metadata.ptr - cdef nvmlVgpuPgpuMetadata_t *pgpu_metadata_ptr = pgpu_metadata.ptr + 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) @@ -24382,9 +24403,9 @@ cpdef tuple get_vgpu_version(): tuple: A tuple of (VgpuVersion supported, VgpuVersion current). """ cdef VgpuVersion supported = VgpuVersion() - cdef nvmlVgpuVersion_t *supported_ptr = supported.ptr + cdef nvmlVgpuVersion_t *supported_ptr = supported._get_ptr() cdef VgpuVersion current = VgpuVersion() - cdef nvmlVgpuVersion_t *current_ptr = current.ptr + cdef nvmlVgpuVersion_t *current_ptr = current._get_ptr() with nogil: __status__ = nvmlGetVgpuVersion(supported_ptr, current_ptr) @@ -24404,7 +24425,7 @@ cpdef object device_get_vgpu_instances_utilization_info(intptr_t device): VgpuInstancesUtilizationInfo_v1: The vGPU instances utilization information structure. """ cdef VgpuInstancesUtilizationInfo_v1 vgpuUtilInfo = VgpuInstancesUtilizationInfo_v1() - cdef nvmlVgpuInstancesUtilizationInfo_v1_t *ptr = vgpuUtilInfo.ptr + cdef nvmlVgpuInstancesUtilizationInfo_v1_t *ptr = vgpuUtilInfo._get_ptr() with nogil: ptr.version = sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t) | (1 << 24) @@ -24437,7 +24458,7 @@ cpdef object device_get_vgpu_processes_utilization_info(intptr_t device, unsigne VgpuProcessesUtilizationInfo: The vGPU processes utilization information structure. """ cdef VgpuProcessesUtilizationInfo_v1 vgpuProcUtilInfo = VgpuProcessesUtilizationInfo_v1() - cdef nvmlVgpuProcessesUtilizationInfo_v1_t *ptr = vgpuProcUtilInfo.ptr + cdef nvmlVgpuProcessesUtilizationInfo_v1_t *ptr = vgpuProcUtilInfo._get_ptr() with nogil: ptr.version = sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t) | (1 << 24) @@ -24523,7 +24544,7 @@ cpdef object device_get_sram_unique_uncorrected_ecc_error_counts(intptr_t device """ cdef EccSramUniqueUncorrectedErrorCounts_v1 errorCounts = EccSramUniqueUncorrectedErrorCounts_v1() - cdef nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *ptr = errorCounts.ptr + cdef nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *ptr = errorCounts._get_ptr() with nogil: ptr.version = sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t) | (1 << 24) diff --git a/cuda_bindings/tests/nvml/test_nvlink.py b/cuda_bindings/tests/nvml/test_nvlink.py new file mode 100644 index 0000000000..d0b9724cae --- /dev/null +++ b/cuda_bindings/tests/nvml/test_nvlink.py @@ -0,0 +1,30 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE + + +from cuda.bindings import nvml + + +def test_nvlink_get_link_count(for_all_devices): + """ + Checks that the link count of the device is same. + """ + device = for_all_devices + + fields = nvml.FieldValue(1) + fields[0].field_id = nvml.FI.DEV_NVLINK_LINK_COUNT + value = nvml.device_get_field_values(device, fields)[0] + assert value.nvml_return == nvml.Return.SUCCESS or value.nvml_return == nvml.Return.ERROR_NOT_SUPPORTED, ( + f"Unexpected return {value.nvml_return} for link count field query" + ) + + # Use the alternative argument to device_get_field_values + value = nvml.device_get_field_values(device, [nvml.FI.DEV_NVLINK_LINK_COUNT])[0] + assert value.nvml_return == nvml.Return.SUCCESS or value.nvml_return == nvml.Return.ERROR_NOT_SUPPORTED, ( + f"Unexpected return {value.nvml_return} for link count field query" + ) + + # The feature_nvlink_supported detection is not robust, so we + # can't be more specific about how many links we should find. + if value.nvml_return == nvml.Return.SUCCESS: + assert value.value.ui_val <= nvml.NVLINK_MAX_LINKS, f"Unexpected link count {value.value.ui_val}" diff --git a/cuda_bindings/tests/nvml/test_page_retirement.py b/cuda_bindings/tests/nvml/test_page_retirement.py new file mode 100644 index 0000000000..e9e9f8a473 --- /dev/null +++ b/cuda_bindings/tests/nvml/test_page_retirement.py @@ -0,0 +1,61 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE + +import pytest +from cuda.bindings import nvml + +from . import util + +PAGE_RETIREMENT_PUBLIC_CAUSE_TYPES = list(range(nvml.PageRetirementCause.COUNT)) + + +def supports_page_retirement(device): + try: + for source in range(nvml.PageRetirementCause.COUNT): + nvml.device_get_retired_pages(device, source) + return True + except nvml.NotSupportedError as e: + return False + except nvml.FunctionNotFoundError as e: + return False + + +def test_page_retirement_notsupported(for_all_devices): + """ + Verifies that on platforms that don't supports page retirement, APIs will return Not Supported + """ + device = for_all_devices + + if supports_page_retirement(device): + pytest.skip("page_retirement not supported") + + if not util.supports_ecc(device): + pytest.skip("device doesn't support ECC") + + with pytest.raises(nvml.NotSupportedError): + for source in PAGE_RETIREMENT_PUBLIC_CAUSE_TYPES: + nvml.device_get_retired_pages(device, source) + + with pytest.raises(nvml.NotSupportedError): + nvml.device_get_retired_pages_pending_status(device) + + +def test_page_retirement_supported(for_all_devices): + """ + Verifies that on platforms that support page_retirement, APIs will return success + """ + device = for_all_devices + + if not supports_page_retirement(device): + pytest.skip("page_retirement not supported") + + if not util.supports_ecc(device): + pytest.skip("device doesn't support ECC") + + try: + for source in PAGE_RETIREMENT_PUBLIC_CAUSE_TYPES: + nvml.device_get_retired_pages(device, source) + except nvml.NotSupportedError: + pytest.skip("Exception case: Page retirment is not supported in this GPU") + + nvml.device_get_retired_pages_pending_status(device) diff --git a/cuda_bindings/tests/nvml/util.py b/cuda_bindings/tests/nvml/util.py index 00154330a7..4810e370b3 100644 --- a/cuda_bindings/tests/nvml/util.py +++ b/cuda_bindings/tests/nvml/util.py @@ -29,7 +29,7 @@ def is_vgpu(device): def supports_ecc(device): try: (cur_ecc, pend_ecc) = nvml.device_get_ecc_mode(device) - return cur_ecc != nvml.Feature.FEATURE_DISABLED + return cur_ecc != nvml.EnableState.FEATURE_DISABLED except nvml.NotSupportedError as e: return False From 275408135ba2a1c84fcdb519cdf5ddd9a17c8e2e Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Mon, 1 Dec 2025 09:22:24 -0500 Subject: [PATCH 4/9] Whitespace fixes --- cuda_bindings/cuda/bindings/cufile.pxd | 4 +- cuda_bindings/cuda/bindings/cufile.pyx | 328 ++-- cuda_bindings/cuda/bindings/nvml.pyx | 2481 ++++++++++++++++-------- 3 files changed, 1861 insertions(+), 952 deletions(-) diff --git a/cuda_bindings/cuda/bindings/cufile.pxd b/cuda_bindings/cuda/bindings/cufile.pxd index 9fa2361ccd..84b0409f96 100644 --- a/cuda_bindings/cuda/bindings/cufile.pxd +++ b/cuda_bindings/cuda/bindings/cufile.pxd @@ -44,7 +44,7 @@ ctypedef CUFileArrayConfigParameter_t _ArrayConfigParameter ############################################################################### cpdef intptr_t handle_register(intptr_t descr) except? 0 -cpdef void handle_deregister(intptr_t fh) except* +cpdef void handle_deregister(intptr_t fh)except* cpdef buf_register(intptr_t buf_ptr_base, size_t length, int flags) cpdef buf_deregister(intptr_t buf_ptr_base) cpdef driver_open() @@ -58,7 +58,7 @@ cpdef intptr_t batch_io_set_up(unsigned nr) except? 0 cpdef batch_io_submit(intptr_t batch_idp, unsigned nr, intptr_t iocbp, unsigned int flags) cpdef batch_io_get_status(intptr_t batch_idp, unsigned min_nr, intptr_t nr, intptr_t iocbp, intptr_t timeout) cpdef batch_io_cancel(intptr_t batch_idp) -cpdef void batch_io_destroy(intptr_t batch_idp) except* +cpdef void batch_io_destroy(intptr_t batch_idp)except* cpdef read_async(intptr_t fh, intptr_t buf_ptr_base, intptr_t size_p, intptr_t file_offset_p, intptr_t buf_ptr_offset_p, intptr_t bytes_read_p, intptr_t stream) cpdef write_async(intptr_t fh, intptr_t buf_ptr_base, intptr_t size_p, intptr_t file_offset_p, intptr_t buf_ptr_offset_p, intptr_t bytes_written_p, intptr_t stream) cpdef stream_register(intptr_t stream, unsigned flags) diff --git a/cuda_bindings/cuda/bindings/cufile.pyx b/cuda_bindings/cuda/bindings/cufile.pyx index 3cde8aa8fa..ed370e5ec3 100644 --- a/cuda_bindings/cuda/bindings/cufile.pyx +++ b/cuda_bindings/cuda/bindings/cufile.pyx @@ -56,7 +56,6 @@ cdef class _py_anon_pod1: _anon_pod1 *_ptr object _owner bint _readonly - dict _refs def __init__(self): self._ptr = <_anon_pod1 *>calloc(1, sizeof((NULL).handle)) @@ -64,7 +63,6 @@ cdef class _py_anon_pod1: raise MemoryError("Error allocating _py_anon_pod1") self._owner = None self._readonly = False - self._refs = {} def __dealloc__(self): if self._owner is None: @@ -155,17 +153,24 @@ cdef class _py_anon_pod1: obj._ptr = <_anon_pod1 *>ptr obj._owner = owner obj._readonly = readonly - obj._refs = {} return obj -_py_anon_pod3_dtype = _numpy.dtype([ - ("dev_ptr_base", _numpy.intp, ), - ("file_offset", _numpy.int64, ), - ("dev_ptr_offset", _numpy.int64, ), - ("size_", _numpy.uint64, ), - ], align=True) +cdef _get__py_anon_pod3_dtype_offsets(): + cdef _anon_pod3 pod = _anon_pod3() + return _numpy.dtype({ + 'names': ['dev_ptr_base', 'file_offset', 'dev_ptr_offset', 'size_'], + 'formats': [_numpy.intp, _numpy.int64, _numpy.int64, _numpy.uint64], + 'offsets': [ + (&(pod.devPtr_base)) - (&pod), + (&(pod.file_offset)) - (&pod), + (&(pod.devPtr_offset)) - (&pod), + (&(pod.size)) - (&pod), + ], + 'itemsize': sizeof((NULL).u.batch), + }) +_py_anon_pod3_dtype = _get__py_anon_pod3_dtype_offsets() cdef class _py_anon_pod3: """Empty-initialize an instance of `_anon_pod3`. @@ -177,7 +182,6 @@ cdef class _py_anon_pod3: _anon_pod3 *_ptr object _owner bint _readonly - dict _refs def __init__(self): self._ptr = <_anon_pod3 *>calloc(1, sizeof((NULL).u.batch)) @@ -185,7 +189,6 @@ cdef class _py_anon_pod3: raise MemoryError("Error allocating _py_anon_pod3") self._owner = None self._readonly = False - self._refs = {} def __dealloc__(self): if self._owner is None: @@ -298,16 +301,23 @@ cdef class _py_anon_pod3: obj._ptr = <_anon_pod3 *>ptr obj._owner = owner obj._readonly = readonly - obj._refs = {} return obj -io_events_dtype = _numpy.dtype([ - ("cookie", _numpy.intp, ), - ("status", _numpy.int32, ), - ("ret", _numpy.uint64, ), - ], align=True) +cdef _get_io_events_dtype_offsets(): + cdef CUfileIOEvents_t pod = CUfileIOEvents_t() + return _numpy.dtype({ + 'names': ['cookie', 'status', 'ret'], + 'formats': [_numpy.intp, _numpy.int32, _numpy.uint64], + 'offsets': [ + (&(pod.cookie)) - (&pod), + (&(pod.status)) - (&pod), + (&(pod.ret)) - (&pod), + ], + 'itemsize': sizeof(CUfileIOEvents_t), + }) +io_events_dtype = _get_io_events_dtype_offsets() cdef class IOEvents: """Empty-initialize an array of `CUfileIOEvents_t`. @@ -452,11 +462,19 @@ cdef class IOEvents: return obj -op_counter_dtype = _numpy.dtype([ - ("ok", _numpy.uint64, ), - ("err", _numpy.uint64, ), - ], align=True) +cdef _get_op_counter_dtype_offsets(): + cdef CUfileOpCounter_t pod = CUfileOpCounter_t() + return _numpy.dtype({ + 'names': ['ok', 'err'], + 'formats': [_numpy.uint64, _numpy.uint64], + 'offsets': [ + (&(pod.ok)) - (&pod), + (&(pod.err)) - (&pod), + ], + 'itemsize': sizeof(CUfileOpCounter_t), + }) +op_counter_dtype = _get_op_counter_dtype_offsets() cdef class OpCounter: """Empty-initialize an instance of `CUfileOpCounter_t`. @@ -568,39 +586,47 @@ cdef class OpCounter: return obj -per_gpu_stats_dtype = _numpy.dtype([ - ("uuid", _numpy.int8, (16,)), - ("read_bytes", _numpy.uint64, ), - ("read_bw_bytes_per_sec", _numpy.uint64, ), - ("read_utilization", _numpy.uint64, ), - ("read_duration_us", _numpy.uint64, ), - ("n_total_reads", _numpy.uint64, ), - ("n_p2p_reads", _numpy.uint64, ), - ("n_nvfs_reads", _numpy.uint64, ), - ("n_posix_reads", _numpy.uint64, ), - ("n_unaligned_reads", _numpy.uint64, ), - ("n_dr_reads", _numpy.uint64, ), - ("n_sparse_regions", _numpy.uint64, ), - ("n_inline_regions", _numpy.uint64, ), - ("n_reads_err", _numpy.uint64, ), - ("writes_bytes", _numpy.uint64, ), - ("write_bw_bytes_per_sec", _numpy.uint64, ), - ("write_utilization", _numpy.uint64, ), - ("write_duration_us", _numpy.uint64, ), - ("n_total_writes", _numpy.uint64, ), - ("n_p2p_writes", _numpy.uint64, ), - ("n_nvfs_writes", _numpy.uint64, ), - ("n_posix_writes", _numpy.uint64, ), - ("n_unaligned_writes", _numpy.uint64, ), - ("n_dr_writes", _numpy.uint64, ), - ("n_writes_err", _numpy.uint64, ), - ("n_mmap", _numpy.uint64, ), - ("n_mmap_ok", _numpy.uint64, ), - ("n_mmap_err", _numpy.uint64, ), - ("n_mmap_free", _numpy.uint64, ), - ("reg_bytes", _numpy.uint64, ), - ], align=True) - +cdef _get_per_gpu_stats_dtype_offsets(): + cdef CUfilePerGpuStats_t pod = CUfilePerGpuStats_t() + return _numpy.dtype({ + 'names': ['uuid', 'read_bytes', 'read_bw_bytes_per_sec', 'read_utilization', 'read_duration_us', 'n_total_reads', 'n_p2p_reads', 'n_nvfs_reads', 'n_posix_reads', 'n_unaligned_reads', 'n_dr_reads', 'n_sparse_regions', 'n_inline_regions', 'n_reads_err', 'writes_bytes', 'write_bw_bytes_per_sec', 'write_utilization', 'write_duration_us', 'n_total_writes', 'n_p2p_writes', 'n_nvfs_writes', 'n_posix_writes', 'n_unaligned_writes', 'n_dr_writes', 'n_writes_err', 'n_mmap', 'n_mmap_ok', 'n_mmap_err', 'n_mmap_free', 'reg_bytes'], + 'formats': [_numpy.int8, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64], + 'offsets': [ + (&(pod.uuid)) - (&pod), + (&(pod.read_bytes)) - (&pod), + (&(pod.read_bw_bytes_per_sec)) - (&pod), + (&(pod.read_utilization)) - (&pod), + (&(pod.read_duration_us)) - (&pod), + (&(pod.n_total_reads)) - (&pod), + (&(pod.n_p2p_reads)) - (&pod), + (&(pod.n_nvfs_reads)) - (&pod), + (&(pod.n_posix_reads)) - (&pod), + (&(pod.n_unaligned_reads)) - (&pod), + (&(pod.n_dr_reads)) - (&pod), + (&(pod.n_sparse_regions)) - (&pod), + (&(pod.n_inline_regions)) - (&pod), + (&(pod.n_reads_err)) - (&pod), + (&(pod.writes_bytes)) - (&pod), + (&(pod.write_bw_bytes_per_sec)) - (&pod), + (&(pod.write_utilization)) - (&pod), + (&(pod.write_duration_us)) - (&pod), + (&(pod.n_total_writes)) - (&pod), + (&(pod.n_p2p_writes)) - (&pod), + (&(pod.n_nvfs_writes)) - (&pod), + (&(pod.n_posix_writes)) - (&pod), + (&(pod.n_unaligned_writes)) - (&pod), + (&(pod.n_dr_writes)) - (&pod), + (&(pod.n_writes_err)) - (&pod), + (&(pod.n_mmap)) - (&pod), + (&(pod.n_mmap_ok)) - (&pod), + (&(pod.n_mmap_err)) - (&pod), + (&(pod.n_mmap_free)) - (&pod), + (&(pod.reg_bytes)) - (&pod), + ], + 'itemsize': sizeof(CUfilePerGpuStats_t), + }) + +per_gpu_stats_dtype = _get_per_gpu_stats_dtype_offsets() cdef class PerGpuStats: """Empty-initialize an instance of `CUfilePerGpuStats_t`. @@ -1024,12 +1050,20 @@ cdef class PerGpuStats: return obj -descr_dtype = _numpy.dtype([ - ("type", _numpy.int32, ), - ("handle", _py_anon_pod1_dtype, ), - ("fs_ops", _numpy.intp, ), - ], align=True) +cdef _get_descr_dtype_offsets(): + cdef CUfileDescr_t pod = CUfileDescr_t() + return _numpy.dtype({ + 'names': ['type', 'handle', 'fs_ops'], + 'formats': [_numpy.int32, _py_anon_pod1_dtype, _numpy.intp], + 'offsets': [ + (&(pod.type)) - (&pod), + (&(pod.handle)) - (&pod), + (&(pod.fs_ops)) - (&pod), + ], + 'itemsize': sizeof(CUfileDescr_t), + }) +descr_dtype = _get_descr_dtype_offsets() cdef class Descr: """Empty-initialize an array of `CUfileDescr_t`. @@ -1294,52 +1328,60 @@ cdef class _py_anon_pod2: return obj -stats_level1_dtype = _numpy.dtype([ - ("read_ops", op_counter_dtype, ), - ("write_ops", op_counter_dtype, ), - ("hdl_register_ops", op_counter_dtype, ), - ("hdl_deregister_ops", op_counter_dtype, ), - ("buf_register_ops", op_counter_dtype, ), - ("buf_deregister_ops", op_counter_dtype, ), - ("read_bytes", _numpy.uint64, ), - ("write_bytes", _numpy.uint64, ), - ("read_bw_bytes_per_sec", _numpy.uint64, ), - ("write_bw_bytes_per_sec", _numpy.uint64, ), - ("read_lat_avg_us", _numpy.uint64, ), - ("write_lat_avg_us", _numpy.uint64, ), - ("read_ops_per_sec", _numpy.uint64, ), - ("write_ops_per_sec", _numpy.uint64, ), - ("read_lat_sum_us", _numpy.uint64, ), - ("write_lat_sum_us", _numpy.uint64, ), - ("batch_submit_ops", op_counter_dtype, ), - ("batch_complete_ops", op_counter_dtype, ), - ("batch_setup_ops", op_counter_dtype, ), - ("batch_cancel_ops", op_counter_dtype, ), - ("batch_destroy_ops", op_counter_dtype, ), - ("batch_enqueued_ops", op_counter_dtype, ), - ("batch_posix_enqueued_ops", op_counter_dtype, ), - ("batch_processed_ops", op_counter_dtype, ), - ("batch_posix_processed_ops", op_counter_dtype, ), - ("batch_nvfs_submit_ops", op_counter_dtype, ), - ("batch_p2p_submit_ops", op_counter_dtype, ), - ("batch_aio_submit_ops", op_counter_dtype, ), - ("batch_iouring_submit_ops", op_counter_dtype, ), - ("batch_mixed_io_submit_ops", op_counter_dtype, ), - ("batch_total_submit_ops", op_counter_dtype, ), - ("batch_read_bytes", _numpy.uint64, ), - ("batch_write_bytes", _numpy.uint64, ), - ("batch_read_bw_bytes", _numpy.uint64, ), - ("batch_write_bw_bytes", _numpy.uint64, ), - ("batch_submit_lat_avg_us", _numpy.uint64, ), - ("batch_completion_lat_avg_us", _numpy.uint64, ), - ("batch_submit_ops_per_sec", _numpy.uint64, ), - ("batch_complete_ops_per_sec", _numpy.uint64, ), - ("batch_submit_lat_sum_us", _numpy.uint64, ), - ("batch_completion_lat_sum_us", _numpy.uint64, ), - ("last_batch_read_bytes", _numpy.uint64, ), - ("last_batch_write_bytes", _numpy.uint64, ), - ], align=True) - +cdef _get_stats_level1_dtype_offsets(): + cdef CUfileStatsLevel1_t pod = CUfileStatsLevel1_t() + return _numpy.dtype({ + 'names': ['read_ops', 'write_ops', 'hdl_register_ops', 'hdl_deregister_ops', 'buf_register_ops', 'buf_deregister_ops', 'read_bytes', 'write_bytes', 'read_bw_bytes_per_sec', 'write_bw_bytes_per_sec', 'read_lat_avg_us', 'write_lat_avg_us', 'read_ops_per_sec', 'write_ops_per_sec', 'read_lat_sum_us', 'write_lat_sum_us', 'batch_submit_ops', 'batch_complete_ops', 'batch_setup_ops', 'batch_cancel_ops', 'batch_destroy_ops', 'batch_enqueued_ops', 'batch_posix_enqueued_ops', 'batch_processed_ops', 'batch_posix_processed_ops', 'batch_nvfs_submit_ops', 'batch_p2p_submit_ops', 'batch_aio_submit_ops', 'batch_iouring_submit_ops', 'batch_mixed_io_submit_ops', 'batch_total_submit_ops', 'batch_read_bytes', 'batch_write_bytes', 'batch_read_bw_bytes', 'batch_write_bw_bytes', 'batch_submit_lat_avg_us', 'batch_completion_lat_avg_us', 'batch_submit_ops_per_sec', 'batch_complete_ops_per_sec', 'batch_submit_lat_sum_us', 'batch_completion_lat_sum_us', 'last_batch_read_bytes', 'last_batch_write_bytes'], + 'formats': [op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64], + 'offsets': [ + (&(pod.read_ops)) - (&pod), + (&(pod.write_ops)) - (&pod), + (&(pod.hdl_register_ops)) - (&pod), + (&(pod.hdl_deregister_ops)) - (&pod), + (&(pod.buf_register_ops)) - (&pod), + (&(pod.buf_deregister_ops)) - (&pod), + (&(pod.read_bytes)) - (&pod), + (&(pod.write_bytes)) - (&pod), + (&(pod.read_bw_bytes_per_sec)) - (&pod), + (&(pod.write_bw_bytes_per_sec)) - (&pod), + (&(pod.read_lat_avg_us)) - (&pod), + (&(pod.write_lat_avg_us)) - (&pod), + (&(pod.read_ops_per_sec)) - (&pod), + (&(pod.write_ops_per_sec)) - (&pod), + (&(pod.read_lat_sum_us)) - (&pod), + (&(pod.write_lat_sum_us)) - (&pod), + (&(pod.batch_submit_ops)) - (&pod), + (&(pod.batch_complete_ops)) - (&pod), + (&(pod.batch_setup_ops)) - (&pod), + (&(pod.batch_cancel_ops)) - (&pod), + (&(pod.batch_destroy_ops)) - (&pod), + (&(pod.batch_enqueued_ops)) - (&pod), + (&(pod.batch_posix_enqueued_ops)) - (&pod), + (&(pod.batch_processed_ops)) - (&pod), + (&(pod.batch_posix_processed_ops)) - (&pod), + (&(pod.batch_nvfs_submit_ops)) - (&pod), + (&(pod.batch_p2p_submit_ops)) - (&pod), + (&(pod.batch_aio_submit_ops)) - (&pod), + (&(pod.batch_iouring_submit_ops)) - (&pod), + (&(pod.batch_mixed_io_submit_ops)) - (&pod), + (&(pod.batch_total_submit_ops)) - (&pod), + (&(pod.batch_read_bytes)) - (&pod), + (&(pod.batch_write_bytes)) - (&pod), + (&(pod.batch_read_bw_bytes)) - (&pod), + (&(pod.batch_write_bw_bytes)) - (&pod), + (&(pod.batch_submit_lat_avg_us)) - (&pod), + (&(pod.batch_completion_lat_avg_us)) - (&pod), + (&(pod.batch_submit_ops_per_sec)) - (&pod), + (&(pod.batch_complete_ops_per_sec)) - (&pod), + (&(pod.batch_submit_lat_sum_us)) - (&pod), + (&(pod.batch_completion_lat_sum_us)) - (&pod), + (&(pod.last_batch_read_bytes)) - (&pod), + (&(pod.last_batch_write_bytes)) - (&pod), + ], + 'itemsize': sizeof(CUfileStatsLevel1_t), + }) + +stats_level1_dtype = _get_stats_level1_dtype_offsets() cdef class StatsLevel1: """Empty-initialize an instance of `CUfileStatsLevel1_t`. @@ -1923,14 +1965,22 @@ cdef class StatsLevel1: return obj -io_params_dtype = _numpy.dtype([ - ("mode", _numpy.int32, ), - ("u", _py_anon_pod2_dtype, ), - ("fh", _numpy.intp, ), - ("opcode", _numpy.int32, ), - ("cookie", _numpy.intp, ), - ], align=True) +cdef _get_io_params_dtype_offsets(): + cdef CUfileIOParams_t pod = CUfileIOParams_t() + return _numpy.dtype({ + 'names': ['mode', 'u', 'fh', 'opcode', 'cookie'], + 'formats': [_numpy.int32, _py_anon_pod2_dtype, _numpy.intp, _numpy.int32, _numpy.intp], + 'offsets': [ + (&(pod.mode)) - (&pod), + (&(pod.u)) - (&pod), + (&(pod.fh)) - (&pod), + (&(pod.opcode)) - (&pod), + (&(pod.cookie)) - (&pod), + ], + 'itemsize': sizeof(CUfileIOParams_t), + }) +io_params_dtype = _get_io_params_dtype_offsets() cdef class IOParams: """Empty-initialize an array of `CUfileIOParams_t`. @@ -2109,12 +2159,20 @@ cdef class IOParams: return obj -stats_level2_dtype = _numpy.dtype([ - ("basic", stats_level1_dtype, ), - ("read_size_kb_hist", _numpy.uint64, (32,)), - ("write_size_kb_hist", _numpy.uint64, (32,)), - ], align=True) +cdef _get_stats_level2_dtype_offsets(): + cdef CUfileStatsLevel2_t pod = CUfileStatsLevel2_t() + return _numpy.dtype({ + 'names': ['basic', 'read_size_kb_hist', 'write_size_kb_hist'], + 'formats': [stats_level1_dtype, _numpy.uint64, _numpy.uint64], + 'offsets': [ + (&(pod.basic)) - (&pod), + (&(pod.read_size_kb_hist)) - (&pod), + (&(pod.write_size_kb_hist)) - (&pod), + ], + 'itemsize': sizeof(CUfileStatsLevel2_t), + }) +stats_level2_dtype = _get_stats_level2_dtype_offsets() cdef class StatsLevel2: """Empty-initialize an instance of `CUfileStatsLevel2_t`. @@ -2246,12 +2304,20 @@ cdef class StatsLevel2: return obj -stats_level3_dtype = _numpy.dtype([ - ("detailed", stats_level2_dtype, ), - ("num_gpus", _numpy.uint32, ), - ("per_gpu_stats", per_gpu_stats_dtype, (16,)), - ], align=True) +cdef _get_stats_level3_dtype_offsets(): + cdef CUfileStatsLevel3_t pod = CUfileStatsLevel3_t() + return _numpy.dtype({ + 'names': ['detailed', 'num_gpus', 'per_gpu_stats'], + 'formats': [stats_level2_dtype, _numpy.uint32, per_gpu_stats_dtype], + 'offsets': [ + (&(pod.detailed)) - (&pod), + (&(pod.num_gpus)) - (&pod), + (&(pod.per_gpu_stats)) - (&pod), + ], + 'itemsize': sizeof(CUfileStatsLevel3_t), + }) +stats_level3_dtype = _get_stats_level3_dtype_offsets() cdef class StatsLevel3: """Empty-initialize an instance of `CUfileStatsLevel3_t`. @@ -2378,20 +2444,6 @@ cdef class StatsLevel3: return obj -# Hack: Overwrite the generated descr_dtype, which NumPy deduced the offset wrong. -descr_dtype = _numpy.dtype({ - "names": ['type', 'handle', 'fs_ops'], - "formats": [_numpy.int32, _py_anon_pod1_dtype, _numpy.intp], - "offsets": [0, 8, 16], -}, align=True) - -# Hack: Overwrite the generated io_params_dtype, which NumPy deduced the offset wrong. -io_params_dtype = _numpy.dtype({ - "names": ['mode', 'u', 'fh', 'opcode', 'cookie'], - "formats": [_numpy.int32, _py_anon_pod2_dtype, _numpy.intp, _numpy.int32, _numpy.intp], - "offsets": [0, 8, 40, 48, 56], -}, align=True) - ############################################################################### # Enum @@ -2604,7 +2656,7 @@ cpdef intptr_t handle_register(intptr_t descr) except? 0: return fh -cpdef void handle_deregister(intptr_t fh) except*: +cpdef void handle_deregister(intptr_t fh)except*: """releases a registered filehandle from cuFile. Args: @@ -2755,7 +2807,7 @@ cpdef batch_io_cancel(intptr_t batch_idp): check_status(__status__) -cpdef void batch_io_destroy(intptr_t batch_idp) except*: +cpdef void batch_io_destroy(intptr_t batch_idp)except*: cuFileBatchIODestroy(batch_idp) diff --git a/cuda_bindings/cuda/bindings/nvml.pyx b/cuda_bindings/cuda/bindings/nvml.pyx index e89e82ccee..a7a695f7c2 100644 --- a/cuda_bindings/cuda/bindings/nvml.pyx +++ b/cuda_bindings/cuda/bindings/nvml.pyx @@ -1323,18 +1323,26 @@ cpdef int check_status_size(int status) except 1 nogil: ############################################################################### -pci_info_ext_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("domain", _numpy.uint32, ), - ("bus", _numpy.uint32, ), - ("device_", _numpy.uint32, ), - ("pci_device_id", _numpy.uint32, ), - ("pci_sub_system_id", _numpy.uint32, ), - ("base_class", _numpy.uint32, ), - ("sub_class", _numpy.uint32, ), - ("bus_id", _numpy.int8, (32,)), - ], align=True) - +cdef _get_pci_info_ext_v1_dtype_offsets(): + cdef nvmlPciInfoExt_v1_t pod = nvmlPciInfoExt_v1_t() + 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], + '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), + }) + +pci_info_ext_v1_dtype = _get_pci_info_ext_v1_dtype_offsets() cdef class PciInfoExt_v1: """Empty-initialize an instance of `nvmlPciInfoExt_v1_t`. @@ -1527,16 +1535,24 @@ cdef class PciInfoExt_v1: return obj -pci_info_dtype = _numpy.dtype([ - ("bus_id_legacy", _numpy.int8, (16,)), - ("domain", _numpy.uint32, ), - ("bus", _numpy.uint32, ), - ("device_", _numpy.uint32, ), - ("pci_device_id", _numpy.uint32, ), - ("pci_sub_system_id", _numpy.uint32, ), - ("bus_id", _numpy.int8, (32,)), - ], align=True) - +cdef _get_pci_info_dtype_offsets(): + cdef nvmlPciInfo_t pod = nvmlPciInfo_t() + return _numpy.dtype({ + 'names': ['bus_id_legacy', 'domain', 'bus', 'device_', 'pci_device_id', 'pci_sub_system_id', 'bus_id'], + 'formats': [_numpy.int8, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.int8], + '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), + }) + +pci_info_dtype = _get_pci_info_dtype_offsets() cdef class PciInfo: """Empty-initialize an instance of `nvmlPciInfo_t`. @@ -1711,11 +1727,19 @@ cdef class PciInfo: return obj -utilization_dtype = _numpy.dtype([ - ("gpu", _numpy.uint32, ), - ("memory", _numpy.uint32, ), - ], align=True) +cdef _get_utilization_dtype_offsets(): + cdef nvmlUtilization_t pod = nvmlUtilization_t() + return _numpy.dtype({ + 'names': ['gpu', 'memory'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.gpu)) - (&pod), + (&(pod.memory)) - (&pod), + ], + 'itemsize': sizeof(nvmlUtilization_t), + }) +utilization_dtype = _get_utilization_dtype_offsets() cdef class Utilization: """Empty-initialize an instance of `nvmlUtilization_t`. @@ -1827,12 +1851,20 @@ cdef class Utilization: return obj -memory_dtype = _numpy.dtype([ - ("total", _numpy.uint64, ), - ("free", _numpy.uint64, ), - ("used", _numpy.uint64, ), - ], align=True) +cdef _get_memory_dtype_offsets(): + cdef nvmlMemory_t pod = nvmlMemory_t() + 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), + }) +memory_dtype = _get_memory_dtype_offsets() cdef class Memory: """Empty-initialize an instance of `nvmlMemory_t`. @@ -1955,14 +1987,22 @@ cdef class Memory: return obj -memory_v2_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("total", _numpy.uint64, ), - ("reserved", _numpy.uint64, ), - ("free", _numpy.uint64, ), - ("used", _numpy.uint64, ), - ], align=True) +cdef _get_memory_v2_dtype_offsets(): + cdef nvmlMemory_v2_t pod = nvmlMemory_v2_t() + 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), + }) +memory_v2_dtype = _get_memory_v2_dtype_offsets() cdef class Memory_v2: """Empty-initialize an instance of `nvmlMemory_v2_t`. @@ -2096,12 +2136,20 @@ cdef class Memory_v2: return obj -ba_r1memory_dtype = _numpy.dtype([ - ("bar1total", _numpy.uint64, ), - ("bar1free", _numpy.uint64, ), - ("bar1_used", _numpy.uint64, ), - ], align=True) +cdef _get_ba_r1memory_dtype_offsets(): + cdef nvmlBAR1Memory_t pod = nvmlBAR1Memory_t() + return _numpy.dtype({ + 'names': ['bar1total', 'bar1free', 'bar1_used'], + 'formats': [_numpy.uint64, _numpy.uint64, _numpy.uint64], + 'offsets': [ + (&(pod.bar1Total)) - (&pod), + (&(pod.bar1Free)) - (&pod), + (&(pod.bar1Used)) - (&pod), + ], + 'itemsize': sizeof(nvmlBAR1Memory_t), + }) +ba_r1memory_dtype = _get_ba_r1memory_dtype_offsets() cdef class BAR1Memory: """Empty-initialize an instance of `nvmlBAR1Memory_t`. @@ -2224,13 +2272,21 @@ cdef class BAR1Memory: return obj -process_info_dtype = _numpy.dtype([ - ("pid", _numpy.uint32, ), - ("used_gpu_memory", _numpy.uint64, ), - ("gpu_instance_id", _numpy.uint32, ), - ("compute_instance_id", _numpy.uint32, ), - ], align=True) +cdef _get_process_info_dtype_offsets(): + cdef nvmlProcessInfo_t pod = nvmlProcessInfo_t() + 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), + }) +process_info_dtype = _get_process_info_dtype_offsets() cdef class ProcessInfo: """Empty-initialize an array of `nvmlProcessInfo_t`. @@ -2386,14 +2442,22 @@ cdef class ProcessInfo: return obj -process_detail_v1_dtype = _numpy.dtype([ - ("pid", _numpy.uint32, ), - ("used_gpu_memory", _numpy.uint64, ), - ("gpu_instance_id", _numpy.uint32, ), - ("compute_instance_id", _numpy.uint32, ), - ("used_gpu_cc_protected_memory", _numpy.uint64, ), - ], align=True) +cdef _get_process_detail_v1_dtype_offsets(): + cdef nvmlProcessDetail_v1_t pod = nvmlProcessDetail_v1_t() + 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), + }) +process_detail_v1_dtype = _get_process_detail_v1_dtype_offsets() cdef class ProcessDetail_v1: """Empty-initialize an array of `nvmlProcessDetail_v1_t`. @@ -2560,18 +2624,26 @@ cdef class ProcessDetail_v1: return obj -device_attributes_dtype = _numpy.dtype([ - ("multiprocessor_count", _numpy.uint32, ), - ("shared_copy_engine_count", _numpy.uint32, ), - ("shared_decoder_count", _numpy.uint32, ), - ("shared_encoder_count", _numpy.uint32, ), - ("shared_jpeg_count", _numpy.uint32, ), - ("shared_ofa_count", _numpy.uint32, ), - ("gpu_instance_slice_count", _numpy.uint32, ), - ("compute_instance_slice_count", _numpy.uint32, ), - ("memory_size_mb", _numpy.uint64, ), - ], align=True) - +cdef _get_device_attributes_dtype_offsets(): + cdef nvmlDeviceAttributes_t pod = nvmlDeviceAttributes_t() + 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), + }) + +device_attributes_dtype = _get_device_attributes_dtype_offsets() cdef class DeviceAttributes: """Empty-initialize an instance of `nvmlDeviceAttributes_t`. @@ -2760,10 +2832,18 @@ cdef class DeviceAttributes: return obj -c2c_mode_info_v1_dtype = _numpy.dtype([ - ("is_c2c_enabled", _numpy.uint32, ), - ], align=True) +cdef _get_c2c_mode_info_v1_dtype_offsets(): + cdef nvmlC2cModeInfo_v1_t pod = nvmlC2cModeInfo_v1_t() + return _numpy.dtype({ + 'names': ['is_c2c_enabled'], + 'formats': [_numpy.uint32], + 'offsets': [ + (&(pod.isC2cEnabled)) - (&pod), + ], + 'itemsize': sizeof(nvmlC2cModeInfo_v1_t), + }) +c2c_mode_info_v1_dtype = _get_c2c_mode_info_v1_dtype_offsets() cdef class C2cModeInfo_v1: """Empty-initialize an instance of `nvmlC2cModeInfo_v1_t`. @@ -2864,14 +2944,22 @@ cdef class C2cModeInfo_v1: return obj -row_remapper_histogram_values_dtype = _numpy.dtype([ - ("max_", _numpy.uint32, ), - ("high", _numpy.uint32, ), - ("partial", _numpy.uint32, ), - ("low", _numpy.uint32, ), - ("none", _numpy.uint32, ), - ], align=True) +cdef _get_row_remapper_histogram_values_dtype_offsets(): + cdef nvmlRowRemapperHistogramValues_t pod = nvmlRowRemapperHistogramValues_t() + 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), + }) +row_remapper_histogram_values_dtype = _get_row_remapper_histogram_values_dtype_offsets() cdef class RowRemapperHistogramValues: """Empty-initialize an instance of `nvmlRowRemapperHistogramValues_t`. @@ -3016,11 +3104,19 @@ cdef class RowRemapperHistogramValues: return obj -bridge_chip_info_dtype = _numpy.dtype([ - ("type", _numpy.int32, ), - ("fw_version", _numpy.uint32, ), - ], align=True) +cdef _get_bridge_chip_info_dtype_offsets(): + cdef nvmlBridgeChipInfo_t pod = nvmlBridgeChipInfo_t() + return _numpy.dtype({ + 'names': ['type', 'fw_version'], + 'formats': [_numpy.int32, _numpy.uint32], + 'offsets': [ + (&(pod.type)) - (&pod), + (&(pod.fwVersion)) - (&pod), + ], + 'itemsize': sizeof(nvmlBridgeChipInfo_t), + }) +bridge_chip_info_dtype = _get_bridge_chip_info_dtype_offsets() cdef class BridgeChipInfo: """Empty-initialize an array of `nvmlBridgeChipInfo_t`. @@ -3333,14 +3429,22 @@ cdef class Value: return obj -_py_anon_pod0_dtype = _numpy.dtype([ - ("controller", _numpy.int32, ), - ("default_min_temp", _numpy.int32, ), - ("default_max_temp", _numpy.int32, ), - ("current_temp", _numpy.int32, ), - ("target", _numpy.int32, ), - ], align=True) +cdef _get__py_anon_pod0_dtype_offsets(): + cdef _anon_pod0 pod = _anon_pod0() + 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(_anon_pod0), + }) +_py_anon_pod0_dtype = _get__py_anon_pod0_dtype_offsets() cdef class _py_anon_pod0: """Empty-initialize an instance of `_anon_pod0`. @@ -3485,13 +3589,21 @@ cdef class _py_anon_pod0: return obj -cooler_info_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("ind_ex", _numpy.uint32, ), - ("signal_type", _numpy.int32, ), - ("target", _numpy.int32, ), - ], align=True) +cdef _get_cooler_info_v1_dtype_offsets(): + cdef nvmlCoolerInfo_v1_t pod = nvmlCoolerInfo_v1_t() + return _numpy.dtype({ + 'names': ['version', 'ind_ex', '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), + }) +cooler_info_v1_dtype = _get_cooler_info_v1_dtype_offsets() cdef class CoolerInfo_v1: """Empty-initialize an instance of `nvmlCoolerInfo_v1_t`. @@ -3625,11 +3737,19 @@ cdef class CoolerInfo_v1: return obj -margin_temperature_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("margin_temperature", _numpy.int32, ), - ], align=True) +cdef _get_margin_temperature_v1_dtype_offsets(): + cdef nvmlMarginTemperature_v1_t pod = nvmlMarginTemperature_v1_t() + return _numpy.dtype({ + 'names': ['version', 'margin_temperature'], + 'formats': [_numpy.uint32, _numpy.int32], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.marginTemperature)) - (&pod), + ], + 'itemsize': sizeof(nvmlMarginTemperature_v1_t), + }) +margin_temperature_v1_dtype = _get_margin_temperature_v1_dtype_offsets() cdef class MarginTemperature_v1: """Empty-initialize an instance of `nvmlMarginTemperature_v1_t`. @@ -3741,11 +3861,19 @@ cdef class MarginTemperature_v1: return obj -clk_mon_fault_info_dtype = _numpy.dtype([ - ("clk_api_domain", _numpy.uint32, ), - ("clk_domain_fault_mask", _numpy.uint32, ), - ], align=True) +cdef _get_clk_mon_fault_info_dtype_offsets(): + cdef nvmlClkMonFaultInfo_t pod = nvmlClkMonFaultInfo_t() + 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), + }) +clk_mon_fault_info_dtype = _get_clk_mon_fault_info_dtype_offsets() cdef class ClkMonFaultInfo: """Empty-initialize an array of `nvmlClkMonFaultInfo_t`. @@ -3879,15 +4007,23 @@ cdef class ClkMonFaultInfo: return obj -clock_offset_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("type", _numpy.int32, ), - ("pstate", _numpy.int32, ), - ("clock_offset_m_hz", _numpy.int32, ), - ("min_clock_offset_m_hz", _numpy.int32, ), - ("max_clock_offset_m_hz", _numpy.int32, ), - ], align=True) - +cdef _get_clock_offset_v1_dtype_offsets(): + cdef nvmlClockOffset_v1_t pod = nvmlClockOffset_v1_t() + 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), + }) + +clock_offset_v1_dtype = _get_clock_offset_v1_dtype_offsets() cdef class ClockOffset_v1: """Empty-initialize an instance of `nvmlClockOffset_v1_t`. @@ -4043,12 +4179,20 @@ cdef class ClockOffset_v1: return obj -fan_speed_info_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("fan", _numpy.uint32, ), - ("speed", _numpy.uint32, ), - ], align=True) +cdef _get_fan_speed_info_v1_dtype_offsets(): + cdef nvmlFanSpeedInfo_v1_t pod = nvmlFanSpeedInfo_v1_t() + return _numpy.dtype({ + 'names': ['version', 'fan', 'speed'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.fan)) - (&pod), + (&(pod.speed)) - (&pod), + ], + 'itemsize': sizeof(nvmlFanSpeedInfo_v1_t), + }) +fan_speed_info_v1_dtype = _get_fan_speed_info_v1_dtype_offsets() cdef class FanSpeedInfo_v1: """Empty-initialize an instance of `nvmlFanSpeedInfo_v1_t`. @@ -4171,11 +4315,19 @@ cdef class FanSpeedInfo_v1: return obj -device_perf_modes_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("str", _numpy.int8, (2048,)), - ], align=True) +cdef _get_device_perf_modes_v1_dtype_offsets(): + cdef nvmlDevicePerfModes_v1_t pod = nvmlDevicePerfModes_v1_t() + return _numpy.dtype({ + 'names': ['version', 'str'], + 'formats': [_numpy.uint32, _numpy.int8], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.str)) - (&pod), + ], + 'itemsize': sizeof(nvmlDevicePerfModes_v1_t), + }) +device_perf_modes_v1_dtype = _get_device_perf_modes_v1_dtype_offsets() cdef class DevicePerfModes_v1: """Empty-initialize an instance of `nvmlDevicePerfModes_v1_t`. @@ -4291,11 +4443,19 @@ cdef class DevicePerfModes_v1: return obj -device_current_clock_freqs_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("str", _numpy.int8, (2048,)), - ], align=True) +cdef _get_device_current_clock_freqs_v1_dtype_offsets(): + cdef nvmlDeviceCurrentClockFreqs_v1_t pod = nvmlDeviceCurrentClockFreqs_v1_t() + return _numpy.dtype({ + 'names': ['version', 'str'], + 'formats': [_numpy.uint32, _numpy.int8], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.str)) - (&pod), + ], + 'itemsize': sizeof(nvmlDeviceCurrentClockFreqs_v1_t), + }) +device_current_clock_freqs_v1_dtype = _get_device_current_clock_freqs_v1_dtype_offsets() cdef class DeviceCurrentClockFreqs_v1: """Empty-initialize an instance of `nvmlDeviceCurrentClockFreqs_v1_t`. @@ -4411,15 +4571,23 @@ cdef class DeviceCurrentClockFreqs_v1: return obj -process_utilization_sample_dtype = _numpy.dtype([ - ("pid", _numpy.uint32, ), - ("time_stamp", _numpy.uint64, ), - ("sm_util", _numpy.uint32, ), - ("mem_util", _numpy.uint32, ), - ("enc_util", _numpy.uint32, ), - ("dec_util", _numpy.uint32, ), - ], align=True) - +cdef _get_process_utilization_sample_dtype_offsets(): + cdef nvmlProcessUtilizationSample_t pod = nvmlProcessUtilizationSample_t() + 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), + }) + +process_utilization_sample_dtype = _get_process_utilization_sample_dtype_offsets() cdef class ProcessUtilizationSample: """Empty-initialize an array of `nvmlProcessUtilizationSample_t`. @@ -4597,17 +4765,25 @@ cdef class ProcessUtilizationSample: return obj -process_utilization_info_v1_dtype = _numpy.dtype([ - ("time_stamp", _numpy.uint64, ), - ("pid", _numpy.uint32, ), - ("sm_util", _numpy.uint32, ), - ("mem_util", _numpy.uint32, ), - ("enc_util", _numpy.uint32, ), - ("dec_util", _numpy.uint32, ), - ("jpg_util", _numpy.uint32, ), - ("ofa_util", _numpy.uint32, ), - ], align=True) - +cdef _get_process_utilization_info_v1_dtype_offsets(): + cdef nvmlProcessUtilizationInfo_v1_t pod = nvmlProcessUtilizationInfo_v1_t() + 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), + }) + +process_utilization_info_v1_dtype = _get_process_utilization_info_v1_dtype_offsets() cdef class ProcessUtilizationInfo_v1: """Empty-initialize an array of `nvmlProcessUtilizationInfo_v1_t`. @@ -4807,22 +4983,30 @@ cdef class ProcessUtilizationInfo_v1: return obj -ecc_sram_error_status_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("aggregate_unc_parity", _numpy.uint64, ), - ("aggregate_unc_sec_ded", _numpy.uint64, ), - ("aggregate_cor", _numpy.uint64, ), - ("volatile_unc_parity", _numpy.uint64, ), - ("volatile_unc_sec_ded", _numpy.uint64, ), - ("volatile_cor", _numpy.uint64, ), - ("aggregate_unc_bucket_l2", _numpy.uint64, ), - ("aggregate_unc_bucket_sm", _numpy.uint64, ), - ("aggregate_unc_bucket_pcie", _numpy.uint64, ), - ("aggregate_unc_bucket_mcu", _numpy.uint64, ), - ("aggregate_unc_bucket_other", _numpy.uint64, ), - ("b_threshold_exceeded", _numpy.uint32, ), - ], align=True) - +cdef _get_ecc_sram_error_status_v1_dtype_offsets(): + cdef nvmlEccSramErrorStatus_v1_t pod = nvmlEccSramErrorStatus_v1_t() + 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), + }) + +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`. @@ -5055,17 +5239,25 @@ cdef class EccSramErrorStatus_v1: return obj -platform_info_v2_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("ib_guid", _numpy.uint8, (16,)), - ("chassis_serial_number", _numpy.uint8, (16,)), - ("slot_number", _numpy.uint8, ), - ("tray_ind_ex", _numpy.uint8, ), - ("host_id", _numpy.uint8, ), - ("peer_type", _numpy.uint8, ), - ("module_id", _numpy.uint8, ), - ], align=True) - +cdef _get_platform_info_v2_dtype_offsets(): + cdef nvmlPlatformInfo_v2_t pod = nvmlPlatformInfo_v2_t() + return _numpy.dtype({ + 'names': ['version', 'ib_guid', 'chassis_serial_number', 'slot_number', 'tray_ind_ex', 'host_id', 'peer_type', 'module_id'], + 'formats': [_numpy.uint32, _numpy.uint8, _numpy.uint8, _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), + }) + +platform_info_v2_dtype = _get_platform_info_v2_dtype_offsets() cdef class PlatformInfo_v2: """Empty-initialize an instance of `nvmlPlatformInfo_v2_t`. @@ -5251,13 +5443,21 @@ cdef class PlatformInfo_v2: return obj -_py_anon_pod1_dtype = _numpy.dtype([ - ("b_is_present", _numpy.uint32, ), - ("percentage", _numpy.uint32, ), - ("inc_threshold", _numpy.uint32, ), - ("dec_threshold", _numpy.uint32, ), - ], align=True) +cdef _get__py_anon_pod1_dtype_offsets(): + cdef _anon_pod1 pod = _anon_pod1() + 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(_anon_pod1), + }) +_py_anon_pod1_dtype = _get__py_anon_pod1_dtype_offsets() cdef class _py_anon_pod1: """Empty-initialize an instance of `_anon_pod1`. @@ -5391,11 +5591,19 @@ cdef class _py_anon_pod1: return obj -vgpu_heterogeneous_mode_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("mode", _numpy.uint32, ), - ], align=True) +cdef _get_vgpu_heterogeneous_mode_v1_dtype_offsets(): + cdef nvmlVgpuHeterogeneousMode_v1_t pod = nvmlVgpuHeterogeneousMode_v1_t() + return _numpy.dtype({ + 'names': ['version', 'mode'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.mode)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuHeterogeneousMode_v1_t), + }) +vgpu_heterogeneous_mode_v1_dtype = _get_vgpu_heterogeneous_mode_v1_dtype_offsets() cdef class VgpuHeterogeneousMode_v1: """Empty-initialize an instance of `nvmlVgpuHeterogeneousMode_v1_t`. @@ -5507,11 +5715,19 @@ cdef class VgpuHeterogeneousMode_v1: return obj -vgpu_placement_id_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("placement_id", _numpy.uint32, ), - ], align=True) +cdef _get_vgpu_placement_id_v1_dtype_offsets(): + cdef nvmlVgpuPlacementId_v1_t pod = nvmlVgpuPlacementId_v1_t() + return _numpy.dtype({ + 'names': ['version', 'placement_id'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.placementId)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuPlacementId_v1_t), + }) +vgpu_placement_id_v1_dtype = _get_vgpu_placement_id_v1_dtype_offsets() cdef class VgpuPlacementId_v1: """Empty-initialize an instance of `nvmlVgpuPlacementId_v1_t`. @@ -5623,14 +5839,22 @@ cdef class VgpuPlacementId_v1: return obj -vgpu_placement_list_v2_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("placement_size", _numpy.uint32, ), - ("count", _numpy.uint32, ), - ("placement_ids", _numpy.intp, ), - ("mode", _numpy.uint32, ), - ], align=True) +cdef _get_vgpu_placement_list_v2_dtype_offsets(): + cdef nvmlVgpuPlacementList_v2_t pod = nvmlVgpuPlacementList_v2_t() + 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), + }) +vgpu_placement_list_v2_dtype = _get_vgpu_placement_list_v2_dtype_offsets() cdef class VgpuPlacementList_v2: """Empty-initialize an instance of `nvmlVgpuPlacementList_v2_t`. @@ -5775,11 +5999,19 @@ cdef class VgpuPlacementList_v2: return obj -vgpu_type_bar1info_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("bar1size", _numpy.uint64, ), - ], align=True) +cdef _get_vgpu_type_bar1info_v1_dtype_offsets(): + cdef nvmlVgpuTypeBar1Info_v1_t pod = nvmlVgpuTypeBar1Info_v1_t() + return _numpy.dtype({ + 'names': ['version', 'bar1size'], + 'formats': [_numpy.uint32, _numpy.uint64], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.bar1Size)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuTypeBar1Info_v1_t), + }) +vgpu_type_bar1info_v1_dtype = _get_vgpu_type_bar1info_v1_dtype_offsets() cdef class VgpuTypeBar1Info_v1: """Empty-initialize an instance of `nvmlVgpuTypeBar1Info_v1_t`. @@ -5891,19 +6123,27 @@ cdef class VgpuTypeBar1Info_v1: return obj -vgpu_process_utilization_info_v1_dtype = _numpy.dtype([ - ("process_name", _numpy.int8, (64,)), - ("time_stamp", _numpy.uint64, ), - ("vgpu_instance", _numpy.uint32, ), - ("pid", _numpy.uint32, ), - ("sm_util", _numpy.uint32, ), - ("mem_util", _numpy.uint32, ), - ("enc_util", _numpy.uint32, ), - ("dec_util", _numpy.uint32, ), - ("jpg_util", _numpy.uint32, ), - ("ofa_util", _numpy.uint32, ), - ], align=True) - +cdef _get_vgpu_process_utilization_info_v1_dtype_offsets(): + cdef nvmlVgpuProcessUtilizationInfo_v1_t pod = nvmlVgpuProcessUtilizationInfo_v1_t() + 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, _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), + }) + +vgpu_process_utilization_info_v1_dtype = _get_vgpu_process_utilization_info_v1_dtype_offsets() cdef class VgpuProcessUtilizationInfo_v1: """Empty-initialize an array of `nvmlVgpuProcessUtilizationInfo_v1_t`. @@ -6123,11 +6363,19 @@ cdef class VgpuProcessUtilizationInfo_v1: return obj -vgpu_runtime_state_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("size_", _numpy.uint64, ), - ], align=True) +cdef _get_vgpu_runtime_state_v1_dtype_offsets(): + cdef nvmlVgpuRuntimeState_v1_t pod = nvmlVgpuRuntimeState_v1_t() + return _numpy.dtype({ + 'names': ['version', 'size_'], + 'formats': [_numpy.uint32, _numpy.uint64], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.size)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuRuntimeState_v1_t), + }) +vgpu_runtime_state_v1_dtype = _get_vgpu_runtime_state_v1_dtype_offsets() cdef class VgpuRuntimeState_v1: """Empty-initialize an instance of `nvmlVgpuRuntimeState_v1_t`. @@ -6239,11 +6487,19 @@ cdef class VgpuRuntimeState_v1: return obj -_py_anon_pod2_dtype = _numpy.dtype([ - ("avg_factor", _numpy.uint32, ), - ("timeslice", _numpy.uint32, ), - ], align=True) +cdef _get__py_anon_pod2_dtype_offsets(): + cdef _anon_pod2 pod = _anon_pod2() + return _numpy.dtype({ + 'names': ['avg_factor', 'timeslice'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.avgFactor)) - (&pod), + (&(pod.timeslice)) - (&pod), + ], + 'itemsize': sizeof(_anon_pod2), + }) +_py_anon_pod2_dtype = _get__py_anon_pod2_dtype_offsets() cdef class _py_anon_pod2: """Empty-initialize an instance of `_anon_pod2`. @@ -6355,10 +6611,18 @@ cdef class _py_anon_pod2: return obj -_py_anon_pod3_dtype = _numpy.dtype([ - ("timeslice", _numpy.uint32, ), - ], align=True) +cdef _get__py_anon_pod3_dtype_offsets(): + cdef _anon_pod3 pod = _anon_pod3() + return _numpy.dtype({ + 'names': ['timeslice'], + 'formats': [_numpy.uint32], + 'offsets': [ + (&(pod.timeslice)) - (&pod), + ], + 'itemsize': sizeof(_anon_pod3), + }) +_py_anon_pod3_dtype = _get__py_anon_pod3_dtype_offsets() cdef class _py_anon_pod3: """Empty-initialize an instance of `_anon_pod3`. @@ -6459,15 +6723,23 @@ cdef class _py_anon_pod3: return obj -vgpu_scheduler_log_entry_dtype = _numpy.dtype([ - ("timestamp", _numpy.uint64, ), - ("time_run_total", _numpy.uint64, ), - ("time_run", _numpy.uint64, ), - ("sw_runlist_id", _numpy.uint32, ), - ("target_time_slice", _numpy.uint64, ), - ("cumulative_preemption_time", _numpy.uint64, ), - ], align=True) - +cdef _get_vgpu_scheduler_log_entry_dtype_offsets(): + cdef nvmlVgpuSchedulerLogEntry_t pod = nvmlVgpuSchedulerLogEntry_t() + 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), + }) + +vgpu_scheduler_log_entry_dtype = _get_vgpu_scheduler_log_entry_dtype_offsets() cdef class VgpuSchedulerLogEntry: """Empty-initialize an array of `nvmlVgpuSchedulerLogEntry_t`. @@ -6645,11 +6917,19 @@ cdef class VgpuSchedulerLogEntry: return obj -_py_anon_pod4_dtype = _numpy.dtype([ - ("avg_factor", _numpy.uint32, ), - ("frequency", _numpy.uint32, ), - ], align=True) +cdef _get__py_anon_pod4_dtype_offsets(): + cdef _anon_pod4 pod = _anon_pod4() + return _numpy.dtype({ + 'names': ['avg_factor', 'frequency'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.avgFactor)) - (&pod), + (&(pod.frequency)) - (&pod), + ], + 'itemsize': sizeof(_anon_pod4), + }) +_py_anon_pod4_dtype = _get__py_anon_pod4_dtype_offsets() cdef class _py_anon_pod4: """Empty-initialize an instance of `_anon_pod4`. @@ -6761,10 +7041,18 @@ cdef class _py_anon_pod4: return obj -_py_anon_pod5_dtype = _numpy.dtype([ - ("timeslice", _numpy.uint32, ), - ], align=True) +cdef _get__py_anon_pod5_dtype_offsets(): + cdef _anon_pod5 pod = _anon_pod5() + return _numpy.dtype({ + 'names': ['timeslice'], + 'formats': [_numpy.uint32], + 'offsets': [ + (&(pod.timeslice)) - (&pod), + ], + 'itemsize': sizeof(_anon_pod5), + }) +_py_anon_pod5_dtype = _get__py_anon_pod5_dtype_offsets() cdef class _py_anon_pod5: """Empty-initialize an instance of `_anon_pod5`. @@ -6865,17 +7153,25 @@ cdef class _py_anon_pod5: return obj -vgpu_scheduler_capabilities_dtype = _numpy.dtype([ - ("supported_schedulers", _numpy.uint32, (3,)), - ("max_timeslice", _numpy.uint32, ), - ("min_timeslice", _numpy.uint32, ), - ("is_arr_mode_supported", _numpy.uint32, ), - ("max_frequency_for_arr", _numpy.uint32, ), - ("min_frequency_for_arr", _numpy.uint32, ), - ("max_avg_factor_for_arr", _numpy.uint32, ), - ("min_avg_factor_for_arr", _numpy.uint32, ), - ], align=True) - +cdef _get_vgpu_scheduler_capabilities_dtype_offsets(): + cdef nvmlVgpuSchedulerCapabilities_t pod = nvmlVgpuSchedulerCapabilities_t() + 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, _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), + }) + +vgpu_scheduler_capabilities_dtype = _get_vgpu_scheduler_capabilities_dtype_offsets() cdef class VgpuSchedulerCapabilities: """Empty-initialize an instance of `nvmlVgpuSchedulerCapabilities_t`. @@ -7057,16 +7353,24 @@ cdef class VgpuSchedulerCapabilities: return obj -vgpu_license_expiry_dtype = _numpy.dtype([ - ("year", _numpy.uint32, ), - ("month", _numpy.uint16, ), - ("day", _numpy.uint16, ), - ("hour", _numpy.uint16, ), - ("min_", _numpy.uint16, ), - ("sec", _numpy.uint16, ), - ("status", _numpy.uint8, ), - ], align=True) - +cdef _get_vgpu_license_expiry_dtype_offsets(): + cdef nvmlVgpuLicenseExpiry_t pod = nvmlVgpuLicenseExpiry_t() + 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), + }) + +vgpu_license_expiry_dtype = _get_vgpu_license_expiry_dtype_offsets() cdef class VgpuLicenseExpiry: """Empty-initialize an instance of `nvmlVgpuLicenseExpiry_t`. @@ -7233,16 +7537,24 @@ cdef class VgpuLicenseExpiry: return obj -grid_license_expiry_dtype = _numpy.dtype([ - ("year", _numpy.uint32, ), - ("month", _numpy.uint16, ), - ("day", _numpy.uint16, ), - ("hour", _numpy.uint16, ), - ("min_", _numpy.uint16, ), - ("sec", _numpy.uint16, ), - ("status", _numpy.uint8, ), - ], align=True) - +cdef _get_grid_license_expiry_dtype_offsets(): + cdef nvmlGridLicenseExpiry_t pod = nvmlGridLicenseExpiry_t() + 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), + }) + +grid_license_expiry_dtype = _get_grid_license_expiry_dtype_offsets() cdef class GridLicenseExpiry: """Empty-initialize an instance of `nvmlGridLicenseExpiry_t`. @@ -7409,12 +7721,20 @@ cdef class GridLicenseExpiry: return obj -vgpu_type_id_info_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("vgpu_count", _numpy.uint32, ), - ("vgpu_type_ids", _numpy.intp, ), - ], align=True) +cdef _get_vgpu_type_id_info_v1_dtype_offsets(): + cdef nvmlVgpuTypeIdInfo_v1_t pod = nvmlVgpuTypeIdInfo_v1_t() + 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), + }) +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`. @@ -7426,7 +7746,6 @@ cdef class VgpuTypeIdInfo_v1: nvmlVgpuTypeIdInfo_v1_t *_ptr object _owner bint _readonly - dict _refs def __init__(self): self._ptr = calloc(1, sizeof(nvmlVgpuTypeIdInfo_v1_t)) @@ -7434,7 +7753,6 @@ cdef class VgpuTypeIdInfo_v1: raise MemoryError("Error allocating VgpuTypeIdInfo_v1") self._owner = None self._readonly = False - self._refs = {} def __dealloc__(self): if self._owner is None: @@ -7525,16 +7843,23 @@ cdef class VgpuTypeIdInfo_v1: obj._ptr = ptr obj._owner = owner obj._readonly = readonly - obj._refs = {} return obj -vgpu_type_max_instance_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("vgpu_type_id", _numpy.uint32, ), - ("max_instance_per_gi", _numpy.uint32, ), - ], align=True) +cdef _get_vgpu_type_max_instance_v1_dtype_offsets(): + cdef nvmlVgpuTypeMaxInstance_v1_t pod = nvmlVgpuTypeMaxInstance_v1_t() + return _numpy.dtype({ + 'names': ['version', 'vgpu_type_id', 'max_instance_per_gi'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.vgpuTypeId)) - (&pod), + (&(pod.maxInstancePerGI)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuTypeMaxInstance_v1_t), + }) +vgpu_type_max_instance_v1_dtype = _get_vgpu_type_max_instance_v1_dtype_offsets() cdef class VgpuTypeMaxInstance_v1: """Empty-initialize an instance of `nvmlVgpuTypeMaxInstance_v1_t`. @@ -7657,12 +7982,20 @@ cdef class VgpuTypeMaxInstance_v1: return obj -active_vgpu_instance_info_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("vgpu_count", _numpy.uint32, ), - ("vgpu_instances", _numpy.intp, ), - ], align=True) +cdef _get_active_vgpu_instance_info_v1_dtype_offsets(): + cdef nvmlActiveVgpuInstanceInfo_v1_t pod = nvmlActiveVgpuInstanceInfo_v1_t() + 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), + }) +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`. @@ -7674,7 +8007,6 @@ cdef class ActiveVgpuInstanceInfo_v1: nvmlActiveVgpuInstanceInfo_v1_t *_ptr object _owner bint _readonly - dict _refs def __init__(self): self._ptr = calloc(1, sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) @@ -7682,7 +8014,6 @@ cdef class ActiveVgpuInstanceInfo_v1: raise MemoryError("Error allocating ActiveVgpuInstanceInfo_v1") self._owner = None self._readonly = False - self._refs = {} def __dealloc__(self): if self._owner is None: @@ -7773,18 +8104,25 @@ cdef class ActiveVgpuInstanceInfo_v1: obj._ptr = ptr obj._owner = owner obj._readonly = readonly - obj._refs = {} return obj -vgpu_creatable_placement_info_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("vgpu_type_id", _numpy.uint32, ), - ("count", _numpy.uint32, ), - ("placement_ids", _numpy.intp, ), - ("placement_size", _numpy.uint32, ), - ], align=True) +cdef _get_vgpu_creatable_placement_info_v1_dtype_offsets(): + cdef nvmlVgpuCreatablePlacementInfo_v1_t pod = nvmlVgpuCreatablePlacementInfo_v1_t() + 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), + }) +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`. @@ -7929,11 +8267,19 @@ cdef class VgpuCreatablePlacementInfo_v1: return obj -hwbc_entry_dtype = _numpy.dtype([ - ("hwbc_id", _numpy.uint32, ), - ("firmware_version", _numpy.int8, (32,)), - ], align=True) +cdef _get_hwbc_entry_dtype_offsets(): + cdef nvmlHwbcEntry_t pod = nvmlHwbcEntry_t() + return _numpy.dtype({ + 'names': ['hwbc_id', 'firmware_version'], + 'formats': [_numpy.uint32, _numpy.int8], + 'offsets': [ + (&(pod.hwbcId)) - (&pod), + (&(pod.firmwareVersion)) - (&pod), + ], + 'itemsize': sizeof(nvmlHwbcEntry_t), + }) +hwbc_entry_dtype = _get_hwbc_entry_dtype_offsets() cdef class HwbcEntry: """Empty-initialize an array of `nvmlHwbcEntry_t`. @@ -8065,11 +8411,19 @@ cdef class HwbcEntry: return obj -led_state_dtype = _numpy.dtype([ - ("cause", _numpy.int8, (256,)), - ("color", _numpy.int32, ), - ], align=True) +cdef _get_led_state_dtype_offsets(): + cdef nvmlLedState_t pod = nvmlLedState_t() + return _numpy.dtype({ + 'names': ['cause', 'color'], + 'formats': [_numpy.int8, _numpy.int32], + 'offsets': [ + (&(pod.cause)) - (&pod), + (&(pod.color)) - (&pod), + ], + 'itemsize': sizeof(nvmlLedState_t), + }) +led_state_dtype = _get_led_state_dtype_offsets() cdef class LedState: """Empty-initialize an instance of `nvmlLedState_t`. @@ -8185,13 +8539,21 @@ cdef class LedState: return obj -unit_info_dtype = _numpy.dtype([ - ("name", _numpy.int8, (96,)), - ("id", _numpy.int8, (96,)), - ("serial", _numpy.int8, (96,)), - ("firmware_version", _numpy.int8, (96,)), - ], align=True) +cdef _get_unit_info_dtype_offsets(): + cdef nvmlUnitInfo_t pod = nvmlUnitInfo_t() + return _numpy.dtype({ + 'names': ['name', 'id', 'serial', 'firmware_version'], + 'formats': [_numpy.int8, _numpy.int8, _numpy.int8, _numpy.int8], + 'offsets': [ + (&(pod.name)) - (&pod), + (&(pod.id)) - (&pod), + (&(pod.serial)) - (&pod), + (&(pod.firmwareVersion)) - (&pod), + ], + 'itemsize': sizeof(nvmlUnitInfo_t), + }) +unit_info_dtype = _get_unit_info_dtype_offsets() cdef class UnitInfo: """Empty-initialize an instance of `nvmlUnitInfo_t`. @@ -8341,13 +8703,21 @@ cdef class UnitInfo: return obj -psu_info_dtype = _numpy.dtype([ - ("state", _numpy.int8, (256,)), - ("current", _numpy.uint32, ), - ("voltage", _numpy.uint32, ), - ("power", _numpy.uint32, ), - ], align=True) +cdef _get_psu_info_dtype_offsets(): + cdef nvmlPSUInfo_t pod = nvmlPSUInfo_t() + return _numpy.dtype({ + 'names': ['state', 'current', 'voltage', 'power'], + 'formats': [_numpy.int8, _numpy.uint32, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.state)) - (&pod), + (&(pod.current)) - (&pod), + (&(pod.voltage)) - (&pod), + (&(pod.power)) - (&pod), + ], + 'itemsize': sizeof(nvmlPSUInfo_t), + }) +psu_info_dtype = _get_psu_info_dtype_offsets() cdef class PSUInfo: """Empty-initialize an instance of `nvmlPSUInfo_t`. @@ -8485,11 +8855,19 @@ cdef class PSUInfo: return obj -unit_fan_info_dtype = _numpy.dtype([ - ("speed", _numpy.uint32, ), - ("state", _numpy.int32, ), - ], align=True) +cdef _get_unit_fan_info_dtype_offsets(): + cdef nvmlUnitFanInfo_t pod = nvmlUnitFanInfo_t() + return _numpy.dtype({ + 'names': ['speed', 'state'], + 'formats': [_numpy.uint32, _numpy.int32], + 'offsets': [ + (&(pod.speed)) - (&pod), + (&(pod.state)) - (&pod), + ], + 'itemsize': sizeof(nvmlUnitFanInfo_t), + }) +unit_fan_info_dtype = _get_unit_fan_info_dtype_offsets() cdef class UnitFanInfo: """Empty-initialize an array of `nvmlUnitFanInfo_t`. @@ -8623,14 +9001,22 @@ cdef class UnitFanInfo: return obj -event_data_dtype = _numpy.dtype([ - ("device_", _numpy.intp, ), - ("event_type", _numpy.uint64, ), - ("event_data", _numpy.uint64, ), - ("gpu_instance_id", _numpy.uint32, ), - ("compute_instance_id", _numpy.uint32, ), - ], align=True) +cdef _get_event_data_dtype_offsets(): + cdef nvmlEventData_t pod = nvmlEventData_t() + 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), + }) +event_data_dtype = _get_event_data_dtype_offsets() cdef class EventData: """Empty-initialize an instance of `nvmlEventData_t`. @@ -8775,16 +9161,24 @@ cdef class EventData: return obj -accounting_stats_dtype = _numpy.dtype([ - ("gpu_utilization", _numpy.uint32, ), - ("memory_utilization", _numpy.uint32, ), - ("max_memory_usage", _numpy.uint64, ), - ("time", _numpy.uint64, ), - ("start_time", _numpy.uint64, ), - ("is_running", _numpy.uint32, ), - ("reserved", _numpy.uint32, (5,)), - ], align=True) - +cdef _get_accounting_stats_dtype_offsets(): + cdef nvmlAccountingStats_t pod = nvmlAccountingStats_t() + 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], + '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), + }) + +accounting_stats_dtype = _get_accounting_stats_dtype_offsets() cdef class AccountingStats: """Empty-initialize an instance of `nvmlAccountingStats_t`. @@ -8940,17 +9334,25 @@ cdef class AccountingStats: return obj -encoder_session_info_dtype = _numpy.dtype([ - ("session_id", _numpy.uint32, ), - ("pid", _numpy.uint32, ), - ("vgpu_instance", _numpy.uint32, ), - ("codec_type", _numpy.int32, ), - ("h_resolution", _numpy.uint32, ), - ("v_resolution", _numpy.uint32, ), - ("average_fps", _numpy.uint32, ), - ("average_latency", _numpy.uint32, ), - ], align=True) - +cdef _get_encoder_session_info_dtype_offsets(): + cdef nvmlEncoderSessionInfo_t pod = nvmlEncoderSessionInfo_t() + 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), + }) + +encoder_session_info_dtype = _get_encoder_session_info_dtype_offsets() cdef class EncoderSessionInfo: """Empty-initialize an array of `nvmlEncoderSessionInfo_t`. @@ -9150,12 +9552,20 @@ cdef class EncoderSessionInfo: return obj -fbc_stats_dtype = _numpy.dtype([ - ("sessions_count", _numpy.uint32, ), - ("average_fps", _numpy.uint32, ), - ("average_latency", _numpy.uint32, ), - ], align=True) +cdef _get_fbc_stats_dtype_offsets(): + cdef nvmlFBCStats_t pod = nvmlFBCStats_t() + 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), + }) +fbc_stats_dtype = _get_fbc_stats_dtype_offsets() cdef class FBCStats: """Empty-initialize an instance of `nvmlFBCStats_t`. @@ -9278,21 +9688,29 @@ cdef class FBCStats: return obj -fbc_session_info_dtype = _numpy.dtype([ - ("session_id", _numpy.uint32, ), - ("pid", _numpy.uint32, ), - ("vgpu_instance", _numpy.uint32, ), - ("display_ordinal", _numpy.uint32, ), - ("session_type", _numpy.int32, ), - ("session_flags", _numpy.uint32, ), - ("h_max_resolution", _numpy.uint32, ), - ("v_max_resolution", _numpy.uint32, ), - ("h_resolution", _numpy.uint32, ), - ("v_resolution", _numpy.uint32, ), - ("average_fps", _numpy.uint32, ), - ("average_latency", _numpy.uint32, ), - ], align=True) - +cdef _get_fbc_session_info_dtype_offsets(): + cdef nvmlFBCSessionInfo_t pod = nvmlFBCSessionInfo_t() + 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), + }) + +fbc_session_info_dtype = _get_fbc_session_info_dtype_offsets() cdef class FBCSessionInfo: """Empty-initialize an array of `nvmlFBCSessionInfo_t`. @@ -9536,11 +9954,19 @@ cdef class FBCSessionInfo: return obj -conf_compute_system_caps_dtype = _numpy.dtype([ - ("cpu_caps", _numpy.uint32, ), - ("gpus_caps", _numpy.uint32, ), - ], align=True) +cdef _get_conf_compute_system_caps_dtype_offsets(): + cdef nvmlConfComputeSystemCaps_t pod = nvmlConfComputeSystemCaps_t() + return _numpy.dtype({ + 'names': ['cpu_caps', 'gpus_caps'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.cpuCaps)) - (&pod), + (&(pod.gpusCaps)) - (&pod), + ], + 'itemsize': sizeof(nvmlConfComputeSystemCaps_t), + }) +conf_compute_system_caps_dtype = _get_conf_compute_system_caps_dtype_offsets() cdef class ConfComputeSystemCaps: """Empty-initialize an instance of `nvmlConfComputeSystemCaps_t`. @@ -9652,12 +10078,20 @@ cdef class ConfComputeSystemCaps: return obj -conf_compute_system_state_dtype = _numpy.dtype([ - ("environment", _numpy.uint32, ), - ("cc_feature", _numpy.uint32, ), - ("dev_tools_mode", _numpy.uint32, ), - ], align=True) +cdef _get_conf_compute_system_state_dtype_offsets(): + cdef nvmlConfComputeSystemState_t pod = nvmlConfComputeSystemState_t() + 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), + }) +conf_compute_system_state_dtype = _get_conf_compute_system_state_dtype_offsets() cdef class ConfComputeSystemState: """Empty-initialize an instance of `nvmlConfComputeSystemState_t`. @@ -9780,14 +10214,22 @@ cdef class ConfComputeSystemState: return obj -system_conf_compute_settings_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("environment", _numpy.uint32, ), - ("cc_feature", _numpy.uint32, ), - ("dev_tools_mode", _numpy.uint32, ), - ("multi_gpu_mode", _numpy.uint32, ), - ], align=True) +cdef _get_system_conf_compute_settings_v1_dtype_offsets(): + cdef nvmlSystemConfComputeSettings_v1_t pod = nvmlSystemConfComputeSettings_v1_t() + 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), + }) +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`. @@ -9932,11 +10374,19 @@ cdef class SystemConfComputeSettings_v1: return obj -conf_compute_mem_size_info_dtype = _numpy.dtype([ - ("protected_mem_size_kib", _numpy.uint64, ), - ("unprotected_mem_size_kib", _numpy.uint64, ), - ], align=True) +cdef _get_conf_compute_mem_size_info_dtype_offsets(): + cdef nvmlConfComputeMemSizeInfo_t pod = nvmlConfComputeMemSizeInfo_t() + 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), + }) +conf_compute_mem_size_info_dtype = _get_conf_compute_mem_size_info_dtype_offsets() cdef class ConfComputeMemSizeInfo: """Empty-initialize an instance of `nvmlConfComputeMemSizeInfo_t`. @@ -10048,13 +10498,21 @@ cdef class ConfComputeMemSizeInfo: return obj -conf_compute_gpu_certificate_dtype = _numpy.dtype([ - ("cert_chain_size", _numpy.uint32, ), - ("attestation_cert_chain_size", _numpy.uint32, ), - ("cert_chain", _numpy.uint8, (4096,)), - ("attestation_cert_chain", _numpy.uint8, (5120,)), - ], align=True) +cdef _get_conf_compute_gpu_certificate_dtype_offsets(): + cdef nvmlConfComputeGpuCertificate_t pod = nvmlConfComputeGpuCertificate_t() + return _numpy.dtype({ + 'names': ['cert_chain_size', 'attestation_cert_chain_size', 'cert_chain', 'attestation_cert_chain'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint8, _numpy.uint8], + 'offsets': [ + (&(pod.certChainSize)) - (&pod), + (&(pod.attestationCertChainSize)) - (&pod), + (&(pod.certChain)) - (&pod), + (&(pod.attestationCertChain)) - (&pod), + ], + 'itemsize': sizeof(nvmlConfComputeGpuCertificate_t), + }) +conf_compute_gpu_certificate_dtype = _get_conf_compute_gpu_certificate_dtype_offsets() cdef class ConfComputeGpuCertificate: """Empty-initialize an instance of `nvmlConfComputeGpuCertificate_t`. @@ -10196,15 +10654,23 @@ cdef class ConfComputeGpuCertificate: return obj -conf_compute_gpu_attestation_report_dtype = _numpy.dtype([ - ("is_cec_attestation_report_present", _numpy.uint32, ), - ("attestation_report_size", _numpy.uint32, ), - ("cec_attestation_report_size", _numpy.uint32, ), - ("nonce", _numpy.uint8, (32,)), - ("attestation_report", _numpy.uint8, (8192,)), - ("cec_attestation_report", _numpy.uint8, (4096,)), - ], align=True) - +cdef _get_conf_compute_gpu_attestation_report_dtype_offsets(): + cdef nvmlConfComputeGpuAttestationReport_t pod = nvmlConfComputeGpuAttestationReport_t() + 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, _numpy.uint8, _numpy.uint8], + 'offsets': [ + (&(pod.isCecAttestationReportPresent)) - (&pod), + (&(pod.attestationReportSize)) - (&pod), + (&(pod.cecAttestationReportSize)) - (&pod), + (&(pod.nonce)) - (&pod), + (&(pod.attestationReport)) - (&pod), + (&(pod.cecAttestationReport)) - (&pod), + ], + 'itemsize': sizeof(nvmlConfComputeGpuAttestationReport_t), + }) + +conf_compute_gpu_attestation_report_dtype = _get_conf_compute_gpu_attestation_report_dtype_offsets() cdef class ConfComputeGpuAttestationReport: """Empty-initialize an instance of `nvmlConfComputeGpuAttestationReport_t`. @@ -10372,11 +10838,19 @@ cdef class ConfComputeGpuAttestationReport: return obj -conf_compute_get_key_rotation_threshold_info_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("attacker_advantage", _numpy.uint64, ), - ], align=True) +cdef _get_conf_compute_get_key_rotation_threshold_info_v1_dtype_offsets(): + cdef nvmlConfComputeGetKeyRotationThresholdInfo_v1_t pod = nvmlConfComputeGetKeyRotationThresholdInfo_v1_t() + return _numpy.dtype({ + 'names': ['version', 'attacker_advantage'], + 'formats': [_numpy.uint32, _numpy.uint64], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.attackerAdvantage)) - (&pod), + ], + 'itemsize': sizeof(nvmlConfComputeGetKeyRotationThresholdInfo_v1_t), + }) +conf_compute_get_key_rotation_threshold_info_v1_dtype = _get_conf_compute_get_key_rotation_threshold_info_v1_dtype_offsets() cdef class ConfComputeGetKeyRotationThresholdInfo_v1: """Empty-initialize an instance of `nvmlConfComputeGetKeyRotationThresholdInfo_v1_t`. @@ -10488,12 +10962,20 @@ cdef class ConfComputeGetKeyRotationThresholdInfo_v1: return obj -nvlink_supported_bw_modes_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("bw_modes", _numpy.uint8, (23,)), - ("total_bw_modes", _numpy.uint8, ), - ], align=True) +cdef _get_nvlink_supported_bw_modes_v1_dtype_offsets(): + cdef nvmlNvlinkSupportedBwModes_v1_t pod = nvmlNvlinkSupportedBwModes_v1_t() + return _numpy.dtype({ + 'names': ['version', 'bw_modes', 'total_bw_modes'], + 'formats': [_numpy.uint32, _numpy.uint8, _numpy.uint8], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.bwModes)) - (&pod), + (&(pod.totalBwModes)) - (&pod), + ], + 'itemsize': sizeof(nvmlNvlinkSupportedBwModes_v1_t), + }) +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`. @@ -10620,12 +11102,20 @@ cdef class NvlinkSupportedBwModes_v1: return obj -nvlink_get_bw_mode_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("b_is_best", _numpy.uint32, ), - ("bw_mode", _numpy.uint8, ), - ], align=True) +cdef _get_nvlink_get_bw_mode_v1_dtype_offsets(): + cdef nvmlNvlinkGetBwMode_v1_t pod = nvmlNvlinkGetBwMode_v1_t() + 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), + }) +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`. @@ -10748,12 +11238,20 @@ cdef class NvlinkGetBwMode_v1: return obj -nvlink_set_bw_mode_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("b_set_best", _numpy.uint32, ), - ("bw_mode", _numpy.uint8, ), - ], align=True) +cdef _get_nvlink_set_bw_mode_v1_dtype_offsets(): + cdef nvmlNvlinkSetBwMode_v1_t pod = nvmlNvlinkSetBwMode_v1_t() + 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), + }) +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`. @@ -10876,11 +11374,19 @@ cdef class NvlinkSetBwMode_v1: return obj -vgpu_version_dtype = _numpy.dtype([ - ("min_version", _numpy.uint32, ), - ("max_version", _numpy.uint32, ), - ], align=True) +cdef _get_vgpu_version_dtype_offsets(): + cdef nvmlVgpuVersion_t pod = nvmlVgpuVersion_t() + return _numpy.dtype({ + 'names': ['min_version', 'max_version'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.minVersion)) - (&pod), + (&(pod.maxVersion)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuVersion_t), + }) +vgpu_version_dtype = _get_vgpu_version_dtype_offsets() cdef class VgpuVersion: """Empty-initialize an instance of `nvmlVgpuVersion_t`. @@ -10992,19 +11498,27 @@ cdef class VgpuVersion: return obj -vgpu_metadata_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("revision", _numpy.uint32, ), - ("guest_info_state", _numpy.int32, ), - ("guest_driver_version", _numpy.int8, (80,)), - ("host_driver_version", _numpy.int8, (80,)), - ("reserved", _numpy.uint32, (6,)), - ("vgpu_virtualization_caps", _numpy.uint32, ), - ("guest_vgpu_version", _numpy.uint32, ), - ("opaque_data_size", _numpy.uint32, ), - ("opaque_data", _numpy.int8, (4,)), - ], align=True) - +cdef _get_vgpu_metadata_dtype_offsets(): + cdef nvmlVgpuMetadata_t pod = nvmlVgpuMetadata_t() + 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, _numpy.int8, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.int8], + '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), + }) + +vgpu_metadata_dtype = _get_vgpu_metadata_dtype_offsets() cdef class VgpuMetadata: """Empty-initialize an instance of `nvmlVgpuMetadata_t`. @@ -11205,11 +11719,19 @@ cdef class VgpuMetadata: return obj -vgpu_pgpu_compatibility_dtype = _numpy.dtype([ - ("vgpu_vm_compatibility", _numpy.int32, ), - ("compatibility_limit_code", _numpy.int32, ), - ], align=True) +cdef _get_vgpu_pgpu_compatibility_dtype_offsets(): + cdef nvmlVgpuPgpuCompatibility_t pod = nvmlVgpuPgpuCompatibility_t() + 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), + }) +vgpu_pgpu_compatibility_dtype = _get_vgpu_pgpu_compatibility_dtype_offsets() cdef class VgpuPgpuCompatibility: """Empty-initialize an instance of `nvmlVgpuPgpuCompatibility_t`. @@ -11321,11 +11843,19 @@ cdef class VgpuPgpuCompatibility: return obj -gpu_instance_placement_dtype = _numpy.dtype([ - ("start", _numpy.uint32, ), - ("size_", _numpy.uint32, ), - ], align=True) +cdef _get_gpu_instance_placement_dtype_offsets(): + cdef nvmlGpuInstancePlacement_t pod = nvmlGpuInstancePlacement_t() + return _numpy.dtype({ + 'names': ['start', 'size_'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.start)) - (&pod), + (&(pod.size)) - (&pod), + ], + 'itemsize': sizeof(nvmlGpuInstancePlacement_t), + }) +gpu_instance_placement_dtype = _get_gpu_instance_placement_dtype_offsets() cdef class GpuInstancePlacement: """Empty-initialize an array of `nvmlGpuInstancePlacement_t`. @@ -11459,22 +11989,30 @@ cdef class GpuInstancePlacement: return obj -gpu_instance_profile_info_v2_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("id", _numpy.uint32, ), - ("is_p2p_supported", _numpy.uint32, ), - ("slice_count", _numpy.uint32, ), - ("instance_count", _numpy.uint32, ), - ("multiprocessor_count", _numpy.uint32, ), - ("copy_engine_count", _numpy.uint32, ), - ("decoder_count", _numpy.uint32, ), - ("encoder_count", _numpy.uint32, ), - ("jpeg_count", _numpy.uint32, ), - ("ofa_count", _numpy.uint32, ), - ("memory_size_mb", _numpy.uint64, ), - ("name", _numpy.int8, (96,)), - ], align=True) - +cdef _get_gpu_instance_profile_info_v2_dtype_offsets(): + cdef nvmlGpuInstanceProfileInfo_v2_t pod = nvmlGpuInstanceProfileInfo_v2_t() + return _numpy.dtype({ + 'names': ['version', 'id', 'is_p2p_supported', 'slice_count', 'instance_count', 'multiprocessor_count', 'copy_engine_count', 'decoder_count', 'encoder_count', 'jpeg_count', 'ofa_count', 'memory_size_mb', 'name'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint64, _numpy.int8], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.id)) - (&pod), + (&(pod.isP2pSupported)) - (&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), + ], + 'itemsize': sizeof(nvmlGpuInstanceProfileInfo_v2_t), + }) + +gpu_instance_profile_info_v2_dtype = _get_gpu_instance_profile_info_v2_dtype_offsets() cdef class GpuInstanceProfileInfo_v2: """Empty-initialize an instance of `nvmlGpuInstanceProfileInfo_v2_t`. @@ -11711,22 +12249,30 @@ cdef class GpuInstanceProfileInfo_v2: return obj -gpu_instance_profile_info_v3_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("id", _numpy.uint32, ), - ("slice_count", _numpy.uint32, ), - ("instance_count", _numpy.uint32, ), - ("multiprocessor_count", _numpy.uint32, ), - ("copy_engine_count", _numpy.uint32, ), - ("decoder_count", _numpy.uint32, ), - ("encoder_count", _numpy.uint32, ), - ("jpeg_count", _numpy.uint32, ), - ("ofa_count", _numpy.uint32, ), - ("memory_size_mb", _numpy.uint64, ), - ("name", _numpy.int8, (96,)), - ("capabilities", _numpy.uint32, ), - ], align=True) - +cdef _get_gpu_instance_profile_info_v3_dtype_offsets(): + cdef nvmlGpuInstanceProfileInfo_v3_t pod = nvmlGpuInstanceProfileInfo_v3_t() + 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, _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), + }) + +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`. @@ -11963,11 +12509,19 @@ cdef class GpuInstanceProfileInfo_v3: return obj -compute_instance_placement_dtype = _numpy.dtype([ - ("start", _numpy.uint32, ), - ("size_", _numpy.uint32, ), - ], align=True) +cdef _get_compute_instance_placement_dtype_offsets(): + cdef nvmlComputeInstancePlacement_t pod = nvmlComputeInstancePlacement_t() + return _numpy.dtype({ + 'names': ['start', 'size_'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.start)) - (&pod), + (&(pod.size)) - (&pod), + ], + 'itemsize': sizeof(nvmlComputeInstancePlacement_t), + }) +compute_instance_placement_dtype = _get_compute_instance_placement_dtype_offsets() cdef class ComputeInstancePlacement: """Empty-initialize an array of `nvmlComputeInstancePlacement_t`. @@ -12101,20 +12655,28 @@ cdef class ComputeInstancePlacement: return obj -compute_instance_profile_info_v2_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("id", _numpy.uint32, ), - ("slice_count", _numpy.uint32, ), - ("instance_count", _numpy.uint32, ), - ("multiprocessor_count", _numpy.uint32, ), - ("shared_copy_engine_count", _numpy.uint32, ), - ("shared_decoder_count", _numpy.uint32, ), - ("shared_encoder_count", _numpy.uint32, ), - ("shared_jpeg_count", _numpy.uint32, ), - ("shared_ofa_count", _numpy.uint32, ), - ("name", _numpy.int8, (96,)), - ], align=True) - +cdef _get_compute_instance_profile_info_v2_dtype_offsets(): + cdef nvmlComputeInstanceProfileInfo_v2_t pod = nvmlComputeInstanceProfileInfo_v2_t() + 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], + '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), + }) + +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`. @@ -12329,21 +12891,29 @@ cdef class ComputeInstanceProfileInfo_v2: return obj -compute_instance_profile_info_v3_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("id", _numpy.uint32, ), - ("slice_count", _numpy.uint32, ), - ("instance_count", _numpy.uint32, ), - ("multiprocessor_count", _numpy.uint32, ), - ("shared_copy_engine_count", _numpy.uint32, ), - ("shared_decoder_count", _numpy.uint32, ), - ("shared_encoder_count", _numpy.uint32, ), - ("shared_jpeg_count", _numpy.uint32, ), - ("shared_ofa_count", _numpy.uint32, ), - ("name", _numpy.int8, (96,)), - ("capabilities", _numpy.uint32, ), - ], align=True) - +cdef _get_compute_instance_profile_info_v3_dtype_offsets(): + cdef nvmlComputeInstanceProfileInfo_v3_t pod = nvmlComputeInstanceProfileInfo_v3_t() + 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, _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), + }) + +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`. @@ -12569,11 +13139,19 @@ cdef class ComputeInstanceProfileInfo_v3: return obj -gpm_support_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("is_supported_device", _numpy.uint32, ), - ], align=True) +cdef _get_gpm_support_dtype_offsets(): + cdef nvmlGpmSupport_t pod = nvmlGpmSupport_t() + return _numpy.dtype({ + 'names': ['version', 'is_supported_device'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.isSupportedDevice)) - (&pod), + ], + 'itemsize': sizeof(nvmlGpmSupport_t), + }) +gpm_support_dtype = _get_gpm_support_dtype_offsets() cdef class GpmSupport: """Empty-initialize an instance of `nvmlGpmSupport_t`. @@ -12685,11 +13263,19 @@ cdef class GpmSupport: return obj -device_capabilities_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("cap_mask", _numpy.uint32, ), - ], align=True) +cdef _get_device_capabilities_v1_dtype_offsets(): + cdef nvmlDeviceCapabilities_v1_t pod = nvmlDeviceCapabilities_v1_t() + return _numpy.dtype({ + 'names': ['version', 'cap_mask'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.capMask)) - (&pod), + ], + 'itemsize': sizeof(nvmlDeviceCapabilities_v1_t), + }) +device_capabilities_v1_dtype = _get_device_capabilities_v1_dtype_offsets() cdef class DeviceCapabilities_v1: """Empty-initialize an instance of `nvmlDeviceCapabilities_v1_t`. @@ -12801,11 +13387,19 @@ cdef class DeviceCapabilities_v1: return obj -device_addressing_mode_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("value", _numpy.uint32, ), - ], align=True) +cdef _get_device_addressing_mode_v1_dtype_offsets(): + cdef nvmlDeviceAddressingMode_v1_t pod = nvmlDeviceAddressingMode_v1_t() + return _numpy.dtype({ + 'names': ['version', 'value'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.value)) - (&pod), + ], + 'itemsize': sizeof(nvmlDeviceAddressingMode_v1_t), + }) +device_addressing_mode_v1_dtype = _get_device_addressing_mode_v1_dtype_offsets() cdef class DeviceAddressingMode_v1: """Empty-initialize an instance of `nvmlDeviceAddressingMode_v1_t`. @@ -12917,12 +13511,20 @@ cdef class DeviceAddressingMode_v1: return obj -repair_status_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("b_channel_repair_pending", _numpy.uint32, ), - ("b_tpc_repair_pending", _numpy.uint32, ), - ], align=True) +cdef _get_repair_status_v1_dtype_offsets(): + cdef nvmlRepairStatus_v1_t pod = nvmlRepairStatus_v1_t() + 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), + }) +repair_status_v1_dtype = _get_repair_status_v1_dtype_offsets() cdef class RepairStatus_v1: """Empty-initialize an instance of `nvmlRepairStatus_v1_t`. @@ -13045,11 +13647,19 @@ cdef class RepairStatus_v1: return obj -pdi_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("value", _numpy.uint64, ), - ], align=True) +cdef _get_pdi_v1_dtype_offsets(): + cdef nvmlPdi_v1_t pod = nvmlPdi_v1_t() + return _numpy.dtype({ + 'names': ['version', 'value'], + 'formats': [_numpy.uint32, _numpy.uint64], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.value)) - (&pod), + ], + 'itemsize': sizeof(nvmlPdi_v1_t), + }) +pdi_v1_dtype = _get_pdi_v1_dtype_offsets() cdef class Pdi_v1: """Empty-initialize an instance of `nvmlPdi_v1_t`. @@ -13161,12 +13771,20 @@ cdef class Pdi_v1: return obj -device_power_mizer_modes_v1_dtype = _numpy.dtype([ - ("current_mode", _numpy.uint32, ), - ("mode", _numpy.uint32, ), - ("supported_power_mizer_modes", _numpy.uint32, ), - ], align=True) +cdef _get_device_power_mizer_modes_v1_dtype_offsets(): + cdef nvmlDevicePowerMizerModes_v1_t pod = nvmlDevicePowerMizerModes_v1_t() + 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), + }) +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`. @@ -13289,16 +13907,24 @@ cdef class DevicePowerMizerModes_v1: return obj -ecc_sram_unique_uncorrected_error_entry_v1_dtype = _numpy.dtype([ - ("unit", _numpy.uint32, ), - ("location", _numpy.uint32, ), - ("sublocation", _numpy.uint32, ), - ("extlocation", _numpy.uint32, ), - ("address", _numpy.uint32, ), - ("is_parity", _numpy.uint32, ), - ("count", _numpy.uint32, ), - ], align=True) - +cdef _get_ecc_sram_unique_uncorrected_error_entry_v1_dtype_offsets(): + cdef nvmlEccSramUniqueUncorrectedErrorEntry_v1_t pod = nvmlEccSramUniqueUncorrectedErrorEntry_v1_t() + 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), + }) + +ecc_sram_unique_uncorrected_error_entry_v1_dtype = _get_ecc_sram_unique_uncorrected_error_entry_v1_dtype_offsets() cdef class EccSramUniqueUncorrectedErrorEntry_v1: """Empty-initialize an array of `nvmlEccSramUniqueUncorrectedErrorEntry_v1_t`. @@ -13487,16 +14113,24 @@ cdef class EccSramUniqueUncorrectedErrorEntry_v1: return obj -gpu_fabric_info_v3_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("cluster_uuid", _numpy.uint8, (16,)), - ("status", _numpy.int32, ), - ("clique_id", _numpy.uint32, ), - ("state", _numpy.uint8, ), - ("health_mask", _numpy.uint32, ), - ("health_summary", _numpy.uint8, ), - ], align=True) - +cdef _get_gpu_fabric_info_v3_dtype_offsets(): + cdef nvmlGpuFabricInfo_v3_t pod = nvmlGpuFabricInfo_v3_t() + return _numpy.dtype({ + 'names': ['version', 'cluster_uuid', 'status', 'clique_id', 'state', 'health_mask', 'health_summary'], + 'formats': [_numpy.uint32, _numpy.uint8, _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), + }) + +gpu_fabric_info_v3_dtype = _get_gpu_fabric_info_v3_dtype_offsets() cdef class GpuFabricInfo_v3: """Empty-initialize an instance of `nvmlGpuFabricInfo_v3_t`. @@ -13667,13 +14301,21 @@ cdef class GpuFabricInfo_v3: return obj -nvlink_firmware_version_dtype = _numpy.dtype([ - ("ucode_type", _numpy.uint8, ), - ("major", _numpy.uint32, ), - ("minor", _numpy.uint32, ), - ("sub_minor", _numpy.uint32, ), - ], align=True) +cdef _get_nvlink_firmware_version_dtype_offsets(): + cdef nvmlNvlinkFirmwareVersion_t pod = nvmlNvlinkFirmwareVersion_t() + 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), + }) +nvlink_firmware_version_dtype = _get_nvlink_firmware_version_dtype_offsets() cdef class NvlinkFirmwareVersion: """Empty-initialize an instance of `nvmlNvlinkFirmwareVersion_t`. @@ -13807,11 +14449,19 @@ cdef class NvlinkFirmwareVersion: return obj -excluded_device_info_dtype = _numpy.dtype([ - ("pci_info", pci_info_dtype, ), - ("uuid", _numpy.int8, (80,)), - ], align=True) +cdef _get_excluded_device_info_dtype_offsets(): + cdef nvmlExcludedDeviceInfo_t pod = nvmlExcludedDeviceInfo_t() + return _numpy.dtype({ + 'names': ['pci_info', 'uuid'], + 'formats': [pci_info_dtype, _numpy.int8], + 'offsets': [ + (&(pod.pciInfo)) - (&pod), + (&(pod.uuid)) - (&pod), + ], + 'itemsize': sizeof(nvmlExcludedDeviceInfo_t), + }) +excluded_device_info_dtype = _get_excluded_device_info_dtype_offsets() cdef class ExcludedDeviceInfo: """Empty-initialize an instance of `nvmlExcludedDeviceInfo_t`. @@ -13928,13 +14578,21 @@ cdef class ExcludedDeviceInfo: return obj -process_detail_list_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("mode", _numpy.uint32, ), - ("num_proc_array_entries", _numpy.uint32, ), - ("proc_array", _numpy.intp, ), - ], align=True) +cdef _get_process_detail_list_v1_dtype_offsets(): + cdef nvmlProcessDetailList_v1_t pod = nvmlProcessDetailList_v1_t() + 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), + }) +process_detail_list_v1_dtype = _get_process_detail_list_v1_dtype_offsets() cdef class ProcessDetailList_v1: """Empty-initialize an instance of `nvmlProcessDetailList_v1_t`. @@ -14065,11 +14723,19 @@ cdef class ProcessDetailList_v1: return obj -bridge_chip_hierarchy_dtype = _numpy.dtype([ - ("bridge_count", _numpy.uint8, ), - ("bridge_chip_info", bridge_chip_info_dtype, (128,)), - ], align=True) +cdef _get_bridge_chip_hierarchy_dtype_offsets(): + cdef nvmlBridgeChipHierarchy_t pod = nvmlBridgeChipHierarchy_t() + return _numpy.dtype({ + 'names': ['bridge_count', 'bridge_chip_info'], + 'formats': [_numpy.uint8, bridge_chip_info_dtype], + 'offsets': [ + (&(pod.bridgeCount)) - (&pod), + (&(pod.bridgeChipInfo)) - (&pod), + ], + 'itemsize': sizeof(nvmlBridgeChipHierarchy_t), + }) +bridge_chip_hierarchy_dtype = _get_bridge_chip_hierarchy_dtype_offsets() cdef class BridgeChipHierarchy: """Empty-initialize an instance of `nvmlBridgeChipHierarchy_t`. @@ -14184,11 +14850,19 @@ cdef class BridgeChipHierarchy: return obj -sample_dtype = _numpy.dtype([ - ("time_stamp", _numpy.uint64, ), - ("sample_value", value_dtype, ), - ], align=True) +cdef _get_sample_dtype_offsets(): + cdef nvmlSample_t pod = nvmlSample_t() + return _numpy.dtype({ + 'names': ['time_stamp', 'sample_value'], + 'formats': [_numpy.uint64, value_dtype], + 'offsets': [ + (&(pod.timeStamp)) - (&pod), + (&(pod.sampleValue)) - (&pod), + ], + 'itemsize': sizeof(nvmlSample_t), + }) +sample_dtype = _get_sample_dtype_offsets() cdef class Sample: """Empty-initialize an array of `nvmlSample_t`. @@ -14334,17 +15008,25 @@ cdef class Sample: return obj -vgpu_instance_utilization_info_v1_dtype = _numpy.dtype([ - ("time_stamp", _numpy.uint64, ), - ("vgpu_instance", _numpy.uint32, ), - ("sm_util", value_dtype, ), - ("mem_util", value_dtype, ), - ("enc_util", value_dtype, ), - ("dec_util", value_dtype, ), - ("jpg_util", value_dtype, ), - ("ofa_util", value_dtype, ), - ], align=True) - +cdef _get_vgpu_instance_utilization_info_v1_dtype_offsets(): + cdef nvmlVgpuInstanceUtilizationInfo_v1_t pod = nvmlVgpuInstanceUtilizationInfo_v1_t() + 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), + }) + +vgpu_instance_utilization_info_v1_dtype = _get_vgpu_instance_utilization_info_v1_dtype_offsets() cdef class VgpuInstanceUtilizationInfo_v1: """Empty-initialize an array of `nvmlVgpuInstanceUtilizationInfo_v1_t`. @@ -14616,16 +15298,24 @@ cdef class VgpuInstanceUtilizationInfo_v1: return obj -field_value_dtype = _numpy.dtype([ - ("field_id", _numpy.uint32, ), - ("scope_id", _numpy.uint32, ), - ("timestamp", _numpy.int64, ), - ("latency_usec", _numpy.int64, ), - ("value_type", _numpy.int32, ), - ("nvml_return", _numpy.int32, ), - ("value", value_dtype, ), - ], align=True) - +cdef _get_field_value_dtype_offsets(): + cdef nvmlFieldValue_t pod = nvmlFieldValue_t() + 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), + }) + +field_value_dtype = _get_field_value_dtype_offsets() cdef class FieldValue: """Empty-initialize an array of `nvmlFieldValue_t`. @@ -14826,11 +15516,19 @@ cdef class FieldValue: return obj -gpu_thermal_settings_dtype = _numpy.dtype([ - ("count", _numpy.uint32, ), - ("sensor", _py_anon_pod0_dtype, (3,)), - ], align=True) +cdef _get_gpu_thermal_settings_dtype_offsets(): + cdef nvmlGpuThermalSettings_t pod = nvmlGpuThermalSettings_t() + return _numpy.dtype({ + 'names': ['count', 'sensor'], + 'formats': [_numpy.uint32, _py_anon_pod0_dtype], + 'offsets': [ + (&(pod.count)) - (&pod), + (&(pod.sensor)) - (&pod), + ], + 'itemsize': sizeof(nvmlGpuThermalSettings_t), + }) +gpu_thermal_settings_dtype = _get_gpu_thermal_settings_dtype_offsets() cdef class GpuThermalSettings: """Empty-initialize an instance of `nvmlGpuThermalSettings_t`. @@ -14945,12 +15643,20 @@ cdef class GpuThermalSettings: return obj -clk_mon_status_dtype = _numpy.dtype([ - ("b_global_status", _numpy.uint32, ), - ("clk_mon_list_size", _numpy.uint32, ), - ("clk_mon_list", clk_mon_fault_info_dtype, (32,)), - ], align=True) +cdef _get_clk_mon_status_dtype_offsets(): + cdef nvmlClkMonStatus_t pod = nvmlClkMonStatus_t() + return _numpy.dtype({ + 'names': ['b_global_status', 'clk_mon_list_size', 'clk_mon_list'], + 'formats': [_numpy.uint32, _numpy.uint32, clk_mon_fault_info_dtype], + 'offsets': [ + (&(pod.bGlobalStatus)) - (&pod), + (&(pod.clkMonListSize)) - (&pod), + (&(pod.clkMonList)) - (&pod), + ], + 'itemsize': sizeof(nvmlClkMonStatus_t), + }) +clk_mon_status_dtype = _get_clk_mon_status_dtype_offsets() cdef class ClkMonStatus: """Empty-initialize an instance of `nvmlClkMonStatus_t`. @@ -15076,13 +15782,21 @@ cdef class ClkMonStatus: return obj -processes_utilization_info_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("process_samples_count", _numpy.uint32, ), - ("last_seen_time_stamp", _numpy.uint64, ), - ("proc_util_array", _numpy.intp, ), - ], align=True) +cdef _get_processes_utilization_info_v1_dtype_offsets(): + cdef nvmlProcessesUtilizationInfo_v1_t pod = nvmlProcessesUtilizationInfo_v1_t() + 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), + }) +processes_utilization_info_v1_dtype = _get_processes_utilization_info_v1_dtype_offsets() cdef class ProcessesUtilizationInfo_v1: """Empty-initialize an instance of `nvmlProcessesUtilizationInfo_v1_t`. @@ -15213,11 +15927,19 @@ cdef class ProcessesUtilizationInfo_v1: return obj -gpu_dynamic_pstates_info_dtype = _numpy.dtype([ - ("flags_", _numpy.uint32, ), - ("utilization", _py_anon_pod1_dtype, (8,)), - ], align=True) +cdef _get_gpu_dynamic_pstates_info_dtype_offsets(): + cdef nvmlGpuDynamicPstatesInfo_t pod = nvmlGpuDynamicPstatesInfo_t() + return _numpy.dtype({ + 'names': ['flags_', 'utilization'], + 'formats': [_numpy.uint32, _py_anon_pod1_dtype], + 'offsets': [ + (&(pod.flags)) - (&pod), + (&(pod.utilization)) - (&pod), + ], + 'itemsize': sizeof(nvmlGpuDynamicPstatesInfo_t), + }) +gpu_dynamic_pstates_info_dtype = _get_gpu_dynamic_pstates_info_dtype_offsets() cdef class GpuDynamicPstatesInfo: """Empty-initialize an instance of `nvmlGpuDynamicPstatesInfo_t`. @@ -15332,13 +16054,21 @@ cdef class GpuDynamicPstatesInfo: return obj -vgpu_processes_utilization_info_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("vgpu_process_count", _numpy.uint32, ), - ("last_seen_time_stamp", _numpy.uint64, ), - ("vgpu_proc_util_array", _numpy.intp, ), - ], align=True) +cdef _get_vgpu_processes_utilization_info_v1_dtype_offsets(): + cdef nvmlVgpuProcessesUtilizationInfo_v1_t pod = nvmlVgpuProcessesUtilizationInfo_v1_t() + 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), + }) +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`. @@ -15711,12 +16441,20 @@ cdef class VgpuSchedulerSetParams: return obj -vgpu_license_info_dtype = _numpy.dtype([ - ("is_licensed", _numpy.uint8, ), - ("license_expiry", vgpu_license_expiry_dtype, ), - ("current_state", _numpy.uint32, ), - ], align=True) +cdef _get_vgpu_license_info_dtype_offsets(): + cdef nvmlVgpuLicenseInfo_t pod = nvmlVgpuLicenseInfo_t() + 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), + }) +vgpu_license_info_dtype = _get_vgpu_license_info_dtype_offsets() cdef class VgpuLicenseInfo: """Empty-initialize an instance of `nvmlVgpuLicenseInfo_t`. @@ -15840,15 +16578,23 @@ cdef class VgpuLicenseInfo: return obj -grid_licensable_feature_dtype = _numpy.dtype([ - ("feature_code", _numpy.int32, ), - ("feature_state", _numpy.uint32, ), - ("license_info", _numpy.int8, (128,)), - ("product_name", _numpy.int8, (128,)), - ("feature_enabled", _numpy.uint32, ), - ("license_expiry", grid_license_expiry_dtype, ), - ], align=True) - +cdef _get_grid_licensable_feature_dtype_offsets(): + cdef nvmlGridLicensableFeature_t pod = nvmlGridLicensableFeature_t() + return _numpy.dtype({ + 'names': ['feature_code', 'feature_state', 'license_info', 'product_name', 'feature_enabled', 'license_expiry'], + 'formats': [_numpy.int32, _numpy.uint32, _numpy.int8, _numpy.int8, _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), + }) + +grid_licensable_feature_dtype = _get_grid_licensable_feature_dtype_offsets() cdef class GridLicensableFeature: """Empty-initialize an array of `nvmlGridLicensableFeature_t`. @@ -16034,11 +16780,19 @@ cdef class GridLicensableFeature: return obj -unit_fan_speeds_dtype = _numpy.dtype([ - ("fans", unit_fan_info_dtype, (24,)), - ("count", _numpy.uint32, ), - ], align=True) +cdef _get_unit_fan_speeds_dtype_offsets(): + cdef nvmlUnitFanSpeeds_t pod = nvmlUnitFanSpeeds_t() + return _numpy.dtype({ + 'names': ['fans', 'count'], + 'formats': [unit_fan_info_dtype, _numpy.uint32], + 'offsets': [ + (&(pod.fans)) - (&pod), + (&(pod.count)) - (&pod), + ], + 'itemsize': sizeof(nvmlUnitFanSpeeds_t), + }) +unit_fan_speeds_dtype = _get_unit_fan_speeds_dtype_offsets() cdef class UnitFanSpeeds: """Empty-initialize an instance of `nvmlUnitFanSpeeds_t`. @@ -16153,17 +16907,25 @@ cdef class UnitFanSpeeds: return obj -vgpu_pgpu_metadata_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("revision", _numpy.uint32, ), - ("host_driver_version", _numpy.int8, (80,)), - ("pgpu_virtualization_caps", _numpy.uint32, ), - ("reserved", _numpy.uint32, (5,)), - ("host_supported_vgpu_range", vgpu_version_dtype, ), - ("opaque_data_size", _numpy.uint32, ), - ("opaque_data", _numpy.int8, (4,)), - ], align=True) - +cdef _get_vgpu_pgpu_metadata_dtype_offsets(): + cdef nvmlVgpuPgpuMetadata_t pod = nvmlVgpuPgpuMetadata_t() + 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, _numpy.uint32, _numpy.uint32, vgpu_version_dtype, _numpy.uint32, _numpy.int8], + '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), + }) + +vgpu_pgpu_metadata_dtype = _get_vgpu_pgpu_metadata_dtype_offsets() cdef class VgpuPgpuMetadata: """Empty-initialize an instance of `nvmlVgpuPgpuMetadata_t`. @@ -16339,13 +17101,21 @@ cdef class VgpuPgpuMetadata: return obj -gpu_instance_info_dtype = _numpy.dtype([ - ("device_", _numpy.intp, ), - ("id", _numpy.uint32, ), - ("profile_id", _numpy.uint32, ), - ("placement", gpu_instance_placement_dtype, ), - ], align=True) +cdef _get_gpu_instance_info_dtype_offsets(): + cdef nvmlGpuInstanceInfo_t pod = nvmlGpuInstanceInfo_t() + 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), + }) +gpu_instance_info_dtype = _get_gpu_instance_info_dtype_offsets() cdef class GpuInstanceInfo: """Empty-initialize an instance of `nvmlGpuInstanceInfo_t`. @@ -16480,14 +17250,22 @@ cdef class GpuInstanceInfo: return obj -compute_instance_info_dtype = _numpy.dtype([ - ("device_", _numpy.intp, ), - ("gpu_instance", _numpy.intp, ), - ("id", _numpy.uint32, ), - ("profile_id", _numpy.uint32, ), - ("placement", compute_instance_placement_dtype, ), - ], align=True) +cdef _get_compute_instance_info_dtype_offsets(): + cdef nvmlComputeInstanceInfo_t pod = nvmlComputeInstanceInfo_t() + 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), + }) +compute_instance_info_dtype = _get_compute_instance_info_dtype_offsets() cdef class ComputeInstanceInfo: """Empty-initialize an instance of `nvmlComputeInstanceInfo_t`. @@ -16633,12 +17411,20 @@ cdef class ComputeInstanceInfo: return obj -ecc_sram_unique_uncorrected_error_counts_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("entry_count", _numpy.uint32, ), - ("entries", _numpy.intp, ), - ], align=True) +cdef _get_ecc_sram_unique_uncorrected_error_counts_v1_dtype_offsets(): + cdef nvmlEccSramUniqueUncorrectedErrorCounts_v1_t pod = nvmlEccSramUniqueUncorrectedErrorCounts_v1_t() + 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), + }) +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`. @@ -16758,11 +17544,19 @@ cdef class EccSramUniqueUncorrectedErrorCounts_v1: return obj -nvlink_firmware_info_dtype = _numpy.dtype([ - ("firmware_version", nvlink_firmware_version_dtype, (100,)), - ("num_valid_entries", _numpy.uint32, ), - ], align=True) +cdef _get_nvlink_firmware_info_dtype_offsets(): + cdef nvmlNvlinkFirmwareInfo_t pod = nvmlNvlinkFirmwareInfo_t() + return _numpy.dtype({ + 'names': ['firmware_version', 'num_valid_entries'], + 'formats': [nvlink_firmware_version_dtype, _numpy.uint32], + 'offsets': [ + (&(pod.firmwareVersion)) - (&pod), + (&(pod.numValidEntries)) - (&pod), + ], + 'itemsize': sizeof(nvmlNvlinkFirmwareInfo_t), + }) +nvlink_firmware_info_dtype = _get_nvlink_firmware_info_dtype_offsets() cdef class NvlinkFirmwareInfo: """Empty-initialize an instance of `nvmlNvlinkFirmwareInfo_t`. @@ -16877,14 +17671,22 @@ cdef class NvlinkFirmwareInfo: return obj -vgpu_instances_utilization_info_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("sample_val_type", _numpy.int32, ), - ("vgpu_instance_count", _numpy.uint32, ), - ("last_seen_time_stamp", _numpy.uint64, ), - ("vgpu_util_array", _numpy.intp, ), - ], align=True) +cdef _get_vgpu_instances_utilization_info_v1_dtype_offsets(): + cdef nvmlVgpuInstancesUtilizationInfo_v1_t pod = nvmlVgpuInstancesUtilizationInfo_v1_t() + 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), + }) +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`. @@ -17026,15 +17828,23 @@ cdef class VgpuInstancesUtilizationInfo_v1: return obj -vgpu_scheduler_log_dtype = _numpy.dtype([ - ("engine_id", _numpy.uint32, ), - ("scheduler_policy", _numpy.uint32, ), - ("arr_mode", _numpy.uint32, ), - ("scheduler_params", vgpu_scheduler_params_dtype, ), - ("entries_count", _numpy.uint32, ), - ("log_entries", vgpu_scheduler_log_entry_dtype, (200,)), - ], align=True) - +cdef _get_vgpu_scheduler_log_dtype_offsets(): + cdef nvmlVgpuSchedulerLog_t pod = nvmlVgpuSchedulerLog_t() + 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], + 'offsets': [ + (&(pod.engineId)) - (&pod), + (&(pod.schedulerPolicy)) - (&pod), + (&(pod.arrMode)) - (&pod), + (&(pod.schedulerParams)) - (&pod), + (&(pod.entriesCount)) - (&pod), + (&(pod.logEntries)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuSchedulerLog_t), + }) + +vgpu_scheduler_log_dtype = _get_vgpu_scheduler_log_dtype_offsets() cdef class VgpuSchedulerLog: """Empty-initialize an instance of `nvmlVgpuSchedulerLog_t`. @@ -17194,12 +18004,20 @@ cdef class VgpuSchedulerLog: return obj -vgpu_scheduler_get_state_dtype = _numpy.dtype([ - ("scheduler_policy", _numpy.uint32, ), - ("arr_mode", _numpy.uint32, ), - ("scheduler_params", vgpu_scheduler_params_dtype, ), - ], align=True) +cdef _get_vgpu_scheduler_get_state_dtype_offsets(): + cdef nvmlVgpuSchedulerGetState_t pod = nvmlVgpuSchedulerGetState_t() + 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), + }) +vgpu_scheduler_get_state_dtype = _get_vgpu_scheduler_get_state_dtype_offsets() cdef class VgpuSchedulerGetState: """Empty-initialize an instance of `nvmlVgpuSchedulerGetState_t`. @@ -17323,14 +18141,22 @@ cdef class VgpuSchedulerGetState: return obj -vgpu_scheduler_state_info_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("engine_id", _numpy.uint32, ), - ("scheduler_policy", _numpy.uint32, ), - ("arr_mode", _numpy.uint32, ), - ("scheduler_params", vgpu_scheduler_params_dtype, ), - ], align=True) +cdef _get_vgpu_scheduler_state_info_v1_dtype_offsets(): + cdef nvmlVgpuSchedulerStateInfo_v1_t pod = nvmlVgpuSchedulerStateInfo_v1_t() + 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), + }) +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`. @@ -17476,16 +18302,24 @@ cdef class VgpuSchedulerStateInfo_v1: return obj -vgpu_scheduler_log_info_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("engine_id", _numpy.uint32, ), - ("scheduler_policy", _numpy.uint32, ), - ("arr_mode", _numpy.uint32, ), - ("scheduler_params", vgpu_scheduler_params_dtype, ), - ("entries_count", _numpy.uint32, ), - ("log_entries", vgpu_scheduler_log_entry_dtype, (200,)), - ], align=True) - +cdef _get_vgpu_scheduler_log_info_v1_dtype_offsets(): + cdef nvmlVgpuSchedulerLogInfo_v1_t pod = nvmlVgpuSchedulerLogInfo_v1_t() + 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], + '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), + }) + +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`. @@ -17656,14 +18490,22 @@ cdef class VgpuSchedulerLogInfo_v1: return obj -vgpu_scheduler_state_v1_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("engine_id", _numpy.uint32, ), - ("scheduler_policy", _numpy.uint32, ), - ("enable_arr_mode", _numpy.uint32, ), - ("scheduler_params", vgpu_scheduler_set_params_dtype, ), - ], align=True) +cdef _get_vgpu_scheduler_state_v1_dtype_offsets(): + cdef nvmlVgpuSchedulerState_v1_t pod = nvmlVgpuSchedulerState_v1_t() + 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), + }) +vgpu_scheduler_state_v1_dtype = _get_vgpu_scheduler_state_v1_dtype_offsets() cdef class VgpuSchedulerState_v1: """Empty-initialize an instance of `nvmlVgpuSchedulerState_v1_t`. @@ -17809,12 +18651,20 @@ cdef class VgpuSchedulerState_v1: return obj -grid_licensable_features_dtype = _numpy.dtype([ - ("is_grid_license_supported", _numpy.int32, ), - ("licensable_features_count", _numpy.uint32, ), - ("grid_licensable_features", grid_licensable_feature_dtype, (3,)), - ], align=True) +cdef _get_grid_licensable_features_dtype_offsets(): + cdef nvmlGridLicensableFeatures_t pod = nvmlGridLicensableFeatures_t() + return _numpy.dtype({ + 'names': ['is_grid_license_supported', 'licensable_features_count', 'grid_licensable_features'], + 'formats': [_numpy.int32, _numpy.uint32, grid_licensable_feature_dtype], + 'offsets': [ + (&(pod.isGridLicenseSupported)) - (&pod), + (&(pod.licensableFeaturesCount)) - (&pod), + (&(pod.gridLicensableFeatures)) - (&pod), + ], + 'itemsize': sizeof(nvmlGridLicensableFeatures_t), + }) +grid_licensable_features_dtype = _get_grid_licensable_features_dtype_offsets() cdef class GridLicensableFeatures: """Empty-initialize an instance of `nvmlGridLicensableFeatures_t`. @@ -17940,12 +18790,20 @@ cdef class GridLicensableFeatures: return obj -nv_link_info_v2_dtype = _numpy.dtype([ - ("version", _numpy.uint32, ), - ("is_nvle_enabled", _numpy.uint32, ), - ("firmware_info", nvlink_firmware_info_dtype, ), - ], align=True) +cdef _get_nv_link_info_v2_dtype_offsets(): + cdef nvmlNvLinkInfo_v2_t pod = nvmlNvLinkInfo_v2_t() + 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), + }) +nv_link_info_v2_dtype = _get_nv_link_info_v2_dtype_offsets() cdef class NvLinkInfo_v2: """Empty-initialize an instance of `nvmlNvLinkInfo_v2_t`. @@ -18240,7 +19098,7 @@ cpdef intptr_t unit_get_handle_by_index(unsigned int ind_ex) except? 0: return unit -cpdef object unit_get_unit_info(intptr_t unit) : +cpdef object unit_get_unit_info(intptr_t unit): """Retrieves the static information associated with a unit. Args: @@ -18259,7 +19117,7 @@ cpdef object unit_get_unit_info(intptr_t unit) : return info_py -cpdef object unit_get_led_state(intptr_t unit) : +cpdef object unit_get_led_state(intptr_t unit): """Retrieves the LED state associated with this unit. Args: @@ -18278,7 +19136,7 @@ cpdef object unit_get_led_state(intptr_t unit) : return state_py -cpdef object unit_get_psu_info(intptr_t unit) : +cpdef object unit_get_psu_info(intptr_t unit): """Retrieves the PSU stats for the unit. Args: @@ -18316,7 +19174,7 @@ cpdef unsigned int unit_get_temperature(intptr_t unit, unsigned int type) except return temp -cpdef object unit_get_fan_speed_info(intptr_t unit) : +cpdef object unit_get_fan_speed_info(intptr_t unit): """Retrieves the fan speed readings for the unit. Args: @@ -18350,7 +19208,7 @@ cpdef unsigned int device_get_count_v2() except? 0: return device_count -cpdef object device_get_attributes_v2(intptr_t device) : +cpdef object device_get_attributes_v2(intptr_t device): """Get attributes (engine counts etc.) for the given NVML device handle. Args: @@ -18557,7 +19415,7 @@ cpdef unsigned int device_get_module_id(intptr_t device) except? 0: return module_id -cpdef object device_get_c2c_mode_info_v(intptr_t device) : +cpdef object device_get_c2c_mode_info_v(intptr_t device): """Retrieves the Device's C2C Mode information. Args: @@ -18905,7 +19763,7 @@ cpdef int device_get_persistence_mode(intptr_t device) except? -1: return mode -cpdef object device_get_pci_info_ext(intptr_t device) : +cpdef object device_get_pci_info_ext(intptr_t device): """Retrieves PCI attributes of this device. Args: @@ -18925,7 +19783,7 @@ cpdef object device_get_pci_info_ext(intptr_t device) : return pci_py -cpdef object device_get_pci_info_v3(intptr_t device) : +cpdef object device_get_pci_info_v3(intptr_t device): """Retrieves the PCI attributes of this device. Args: @@ -19270,7 +20128,7 @@ cpdef unsigned int device_get_fan_speed_v2(intptr_t device, unsigned int fan) ex return speed -cpdef object device_get_fan_speed_rpm(intptr_t device) : +cpdef object device_get_fan_speed_rpm(intptr_t device): """Retrieves the intended operating speed in rotations per minute (RPM) of the device's specified fan. Args: @@ -19368,7 +20226,7 @@ cpdef unsigned int device_get_num_fans(intptr_t device) except? 0: return num_fans -cpdef object device_get_cooler_info(intptr_t device) : +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. Args: @@ -19407,7 +20265,7 @@ cpdef unsigned int device_get_temperature_threshold(intptr_t device, int thresho return temp -cpdef object device_get_margin_temperature(intptr_t device) : +cpdef object device_get_margin_temperature(intptr_t device): """Retrieves the thermal margin temperature (distance to nearest slowdown threshold). Args: @@ -19427,7 +20285,7 @@ cpdef object device_get_margin_temperature(intptr_t device) : return margin_temp_info_py -cpdef object device_get_thermal_settings(intptr_t device, unsigned int sensor_ind_ex) : +cpdef object device_get_thermal_settings(intptr_t device, unsigned int sensor_ind_ex): """Used to execute a list of thermal system instructions. Args: @@ -19519,7 +20377,7 @@ cpdef int device_get_power_state(intptr_t device) except? -1: return p_state -cpdef object device_get_dynamic_pstates_info(intptr_t device) : +cpdef object device_get_dynamic_pstates_info(intptr_t device): """Retrieve performance monitor samples from the associated subdevice. Args: @@ -19624,7 +20482,7 @@ cpdef tuple device_get_mem_clk_min_max_vf_offset(intptr_t device): return (min_offset, max_offset) -cpdef object device_get_clock_offsets(intptr_t device) : +cpdef object device_get_clock_offsets(intptr_t device): """Retrieve min, max and current clock offset of some clock domain for a given PState. Args: @@ -19658,7 +20516,7 @@ cpdef device_set_clock_offsets(intptr_t device, intptr_t info): check_status(__status__) -cpdef object device_get_performance_modes(intptr_t device) : +cpdef object 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: @@ -19678,7 +20536,7 @@ cpdef object device_get_performance_modes(intptr_t device) : return perf_modes_py -cpdef object device_get_current_clock_freqs(intptr_t device) : +cpdef object device_get_current_clock_freqs(intptr_t device): """Retrieves a string with the associated current GPU Clock and Memory Clock values. Args: @@ -19832,7 +20690,7 @@ cpdef tuple device_get_gpu_operation_mode(intptr_t device): return (current, pending) -cpdef object device_get_memory_info_v2(intptr_t device) : +cpdef object device_get_memory_info_v2(intptr_t device): """Retrieves the amount of used, free, reserved and total memory available on the device, in bytes. Args: @@ -20045,7 +20903,7 @@ cpdef unsigned long long device_get_memory_error_counter(intptr_t device, int er return count -cpdef object device_get_utilization_rates(intptr_t device) : +cpdef object device_get_utilization_rates(intptr_t device): """Retrieves the current utilization rates for the device's major subsystems. Args: @@ -20217,7 +21075,7 @@ cpdef tuple device_get_ofa_utilization(intptr_t device): return (utilization, sampling_period_us) -cpdef object device_get_fbc_stats(intptr_t device) : +cpdef object device_get_fbc_stats(intptr_t device): """Retrieves the active frame buffer capture sessions statistics for a given device. Args: @@ -20296,7 +21154,7 @@ cpdef str device_get_vbios_version(intptr_t device): return cpython.PyUnicode_FromString(version) -cpdef object device_get_bridge_chip_info(intptr_t device) : +cpdef object device_get_bridge_chip_info(intptr_t device): """Get Bridge Chip Information for all the bridge chips on the board. Args: @@ -20397,7 +21255,7 @@ cpdef int device_get_api_restriction(intptr_t device, int api_type) except? -1: return is_restricted -cpdef object device_get_bar1_memory_info(intptr_t device) : +cpdef object device_get_bar1_memory_info(intptr_t device): """Gets Total, Available and Used size of BAR1 memory. Args: @@ -20560,7 +21418,7 @@ cpdef unsigned int device_get_bus_type(intptr_t device) except? 0: return type -cpdef object device_get_gpu_fabric_info_v(intptr_t device) : +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: @@ -20580,7 +21438,7 @@ cpdef object device_get_gpu_fabric_info_v(intptr_t device) : return gpu_fabric_info_py -cpdef object system_get_conf_compute_capabilities() : +cpdef object system_get_conf_compute_capabilities(): """Get Conf Computing System capabilities. Returns: @@ -20596,7 +21454,7 @@ cpdef object system_get_conf_compute_capabilities() : return capabilities_py -cpdef object system_get_conf_compute_state() : +cpdef object system_get_conf_compute_state(): """Get Conf Computing System State. Returns: @@ -20612,7 +21470,7 @@ cpdef object system_get_conf_compute_state() : return state_py -cpdef object device_get_conf_compute_mem_size_info(intptr_t device) : +cpdef object device_get_conf_compute_mem_size_info(intptr_t device): """Get Conf Computing Protected and Unprotected Memory Sizes. Args: @@ -20646,7 +21504,7 @@ cpdef unsigned int system_get_conf_compute_gpus_ready_state() except? 0: return is_accepting_work -cpdef object device_get_conf_compute_protected_memory_usage(intptr_t device) : +cpdef object device_get_conf_compute_protected_memory_usage(intptr_t device): """Get Conf Computing protected memory usage. Args: @@ -20665,7 +21523,7 @@ cpdef object device_get_conf_compute_protected_memory_usage(intptr_t device) : return memory_py -cpdef object device_get_conf_compute_gpu_certificate(intptr_t device) : +cpdef object device_get_conf_compute_gpu_certificate(intptr_t device): """Get Conf Computing GPU certificate details. Args: @@ -20684,7 +21542,7 @@ cpdef object device_get_conf_compute_gpu_certificate(intptr_t device) : return gpu_cert_py -cpdef object device_get_conf_compute_gpu_attestation_report(intptr_t device) : +cpdef object device_get_conf_compute_gpu_attestation_report(intptr_t device): """Get Conf Computing GPU attestation report. Args: @@ -20703,7 +21561,7 @@ cpdef object device_get_conf_compute_gpu_attestation_report(intptr_t device) : return gpu_atst_report_py -cpdef object system_get_conf_compute_key_rotation_threshold_info() : +cpdef object system_get_conf_compute_key_rotation_threshold_info(): """Get Conf Computing key rotation threshold detail. Returns: @@ -20760,7 +21618,7 @@ cpdef system_set_conf_compute_key_rotation_threshold_info(intptr_t p_key_rotatio check_status(__status__) -cpdef object system_get_conf_compute_settings() : +cpdef object system_get_conf_compute_settings(): """Get Conf Computing System Settings. Returns: @@ -20817,7 +21675,7 @@ cpdef tuple device_get_gsp_firmware_mode(intptr_t device): return (is_enabled, default_mode) -cpdef object device_get_sram_ecc_error_status(intptr_t device) : +cpdef object device_get_sram_ecc_error_status(intptr_t device): """Get SRAM ECC error status of this device. Args: @@ -20855,7 +21713,7 @@ cpdef int device_get_accounting_mode(intptr_t device) except? -1: return mode -cpdef object device_get_accounting_stats(intptr_t device, unsigned int pid) : +cpdef object device_get_accounting_stats(intptr_t device, unsigned int pid): """Queries process's accounting stats. Args: @@ -20982,7 +21840,7 @@ cpdef tuple device_get_remapped_rows(intptr_t device): return (corr_rows, unc_rows, is_pending, failure_occurred) -cpdef object device_get_row_remapper_histogram(intptr_t device) : +cpdef object device_get_row_remapper_histogram(intptr_t device): """Get the row remapper histogram. Returns the remap availability for each bank on the GPU. Args: @@ -21019,7 +21877,7 @@ cpdef unsigned int device_get_architecture(intptr_t device) except? 0: return arch -cpdef object device_get_clk_mon_status(intptr_t device) : +cpdef object device_get_clk_mon_status(intptr_t device): """Retrieves the frequency monitor fault status for the device. Args: @@ -21061,7 +21919,7 @@ cpdef object device_get_process_utilization(intptr_t device, unsigned long long return utilization -cpdef object device_get_platform_info(intptr_t device) : +cpdef object device_get_platform_info(intptr_t device): """Get platform information of this device. Args: @@ -21452,7 +22310,7 @@ cpdef unsigned int device_get_nv_link_capability(intptr_t device, unsigned int l return cap_result -cpdef object device_get_nv_link_remote_pci_info_v2(intptr_t device, unsigned int link) : +cpdef object device_get_nv_link_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. Args: @@ -21567,7 +22425,7 @@ cpdef unsigned int system_get_nvlink_bw_mode() except? 0: return nvlink_bw_mode -cpdef object device_get_nvlink_supported_bw_modes(intptr_t device) : +cpdef object device_get_nvlink_supported_bw_modes(intptr_t device): """Get the supported NvLink Reduced Bandwidth Modes of the device. Args: @@ -21587,7 +22445,7 @@ cpdef object device_get_nvlink_supported_bw_modes(intptr_t device) : return supported_bw_mode_py -cpdef object device_get_nvlink_bw_mode(intptr_t device) : +cpdef object device_get_nvlink_bw_mode(intptr_t device): """Get the NvLink Reduced Bandwidth Mode for the device. Args: @@ -21670,7 +22528,7 @@ cpdef unsigned long long device_get_supported_event_types(intptr_t device) excep return event_types -cpdef object event_set_wait_v2(intptr_t set, unsigned int timeoutms) : +cpdef object event_set_wait_v2(intptr_t set, unsigned int timeoutms): """Waits on events and delivers events. Args: @@ -21865,7 +22723,7 @@ cpdef device_set_virtualization_mode(intptr_t device, int virtual_mode): check_status(__status__) -cpdef object device_get_vgpu_heterogeneous_mode(intptr_t device) : +cpdef object device_get_vgpu_heterogeneous_mode(intptr_t device): """Get the vGPU heterogeneous mode for the device. Args: @@ -21899,7 +22757,7 @@ cpdef device_set_vgpu_heterogeneous_mode(intptr_t device, intptr_t p_heterogeneo check_status(__status__) -cpdef object vgpu_instance_get_placement_id(unsigned int vgpu_instance) : +cpdef object vgpu_instance_get_placement_id(unsigned int vgpu_instance): """Query the placement ID of active vGPU instance. Args: @@ -21919,7 +22777,7 @@ cpdef object vgpu_instance_get_placement_id(unsigned int vgpu_instance) : return p_placement_py -cpdef object device_get_vgpu_type_supported_placements(intptr_t device, unsigned int vgpu_type_id) : +cpdef object device_get_vgpu_type_supported_placements(intptr_t device, unsigned int vgpu_type_id): """Query the supported vGPU placement ID of the vGPU type. Args: @@ -21975,7 +22833,7 @@ cpdef unsigned long long vgpu_type_get_fb_reservation(unsigned int vgpu_type_id) return fb_reservation -cpdef object vgpu_instance_get_runtime_state_size(unsigned int vgpu_instance) : +cpdef object vgpu_instance_get_runtime_state_size(unsigned int vgpu_instance): """Retrieve the currently used runtime state size of the vGPU instance. Args: @@ -22010,7 +22868,7 @@ cpdef device_set_vgpu_capabilities(intptr_t device, int capability, int state): check_status(__status__) -cpdef object device_get_grid_licensable_features_v4(intptr_t device) : +cpdef object device_get_grid_licensable_features_v4(intptr_t device): """Retrieve the vGPU Software licensable features. Args: @@ -22273,7 +23131,7 @@ cpdef unsigned int vgpu_type_get_max_instances_per_vm(unsigned int vgpu_type_id) return vgpu_instance_count_per_vm -cpdef object vgpu_type_get_bar1_info(unsigned int vgpu_type_id) : +cpdef object vgpu_type_get_bar1_info(unsigned int vgpu_type_id): """Retrieve the BAR1 info for given vGPU type. Args: @@ -22493,7 +23351,7 @@ cpdef object vgpu_instance_get_encoder_sessions(unsigned int vgpu_instance): return session_info -cpdef object vgpu_instance_get_fbc_stats(unsigned int vgpu_instance) : +cpdef object vgpu_instance_get_fbc_stats(unsigned int vgpu_instance): """Retrieves the active frame buffer capture sessions statistics of a vGPU Instance. Args: @@ -22609,7 +23467,7 @@ cpdef str vgpu_instance_get_mdev_uuid(unsigned int vgpu_instance): return cpython.PyUnicode_FromString(mdev_uuid) -cpdef object vgpu_type_get_max_instances_per_gpu_instance() : +cpdef object vgpu_type_get_max_instances_per_gpu_instance(): """Retrieve the maximum number of vGPU instances per GPU instance for given vGPU type. Returns: @@ -22640,7 +23498,7 @@ cpdef gpu_instance_set_vgpu_scheduler_state(intptr_t gpu_instance, intptr_t p_sc check_status(__status__) -cpdef object gpu_instance_get_vgpu_scheduler_state(intptr_t gpu_instance) : +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. Args: @@ -22660,7 +23518,7 @@ cpdef object gpu_instance_get_vgpu_scheduler_state(intptr_t gpu_instance) : return p_scheduler_state_info_py -cpdef object gpu_instance_get_vgpu_scheduler_log(intptr_t gpu_instance) : +cpdef object gpu_instance_get_vgpu_scheduler_log(intptr_t gpu_instance): """Returns the vGPU scheduler logs for the given GPU instance. ``pSchedulerLogInfo`` points to a caller-allocated structure to contain the logs. The number of elements returned will never exceed ``NVML_SCHEDULER_SW_MAX_LOG_ENTRIES``. Args: @@ -22680,7 +23538,7 @@ cpdef object gpu_instance_get_vgpu_scheduler_log(intptr_t gpu_instance) : return p_scheduler_log_info_py -cpdef object gpu_instance_get_vgpu_heterogeneous_mode(intptr_t gpu_instance) : +cpdef object gpu_instance_get_vgpu_heterogeneous_mode(intptr_t gpu_instance): """Get the vGPU heterogeneous mode for the GPU instance. Args: @@ -22736,7 +23594,7 @@ cpdef str device_get_pgpu_metadata_string(intptr_t device): return cpython.PyUnicode_FromString(pgpu_metadata) -cpdef object device_get_vgpu_scheduler_log(intptr_t device) : +cpdef object device_get_vgpu_scheduler_log(intptr_t device): """Returns the vGPU Software scheduler logs. ``pSchedulerLog`` points to a caller-allocated structure to contain the logs. The number of elements returned will never exceed ``NVML_SCHEDULER_SW_MAX_LOG_ENTRIES``. Args: @@ -22755,7 +23613,7 @@ cpdef object device_get_vgpu_scheduler_log(intptr_t device) : return p_scheduler_log_py -cpdef object device_get_vgpu_scheduler_state(intptr_t device) : +cpdef object device_get_vgpu_scheduler_state(intptr_t device): """Returns the vGPU scheduler state. The information returned in ``nvmlVgpuSchedulerGetState_t`` is not relevant if the BEST EFFORT policy is set. Args: @@ -22774,7 +23632,7 @@ cpdef object device_get_vgpu_scheduler_state(intptr_t device) : return p_scheduler_state_py -cpdef object device_get_vgpu_scheduler_capabilities(intptr_t device) : +cpdef object device_get_vgpu_scheduler_capabilities(intptr_t device): """Returns the vGPU scheduler capabilities. The list of supported vGPU schedulers returned in ``nvmlVgpuSchedulerCapabilities_t`` is from the NVML_VGPU_SCHEDULER_POLICY_*. This list enumerates the supported scheduler policies if the engine is Graphics type. The other values in ``nvmlVgpuSchedulerCapabilities_t`` are also applicable if the engine is Graphics type. For other engine types, it is BEST EFFORT policy. If ARR is supported and enabled, scheduling frequency and averaging factor are applicable else timeSlice is applicable. Args: @@ -22908,7 +23766,7 @@ cpdef object vgpu_instance_get_accounting_pids(unsigned int vgpu_instance): return pids -cpdef object vgpu_instance_get_accounting_stats(unsigned int vgpu_instance, unsigned int pid) : +cpdef object vgpu_instance_get_accounting_stats(unsigned int vgpu_instance, unsigned int pid): """Queries process's accounting stats. Args: @@ -22941,7 +23799,7 @@ cpdef vgpu_instance_clear_accounting_pids(unsigned int vgpu_instance): check_status(__status__) -cpdef object vgpu_instance_get_license_info_v2(unsigned int vgpu_instance) : +cpdef object vgpu_instance_get_license_info_v2(unsigned int vgpu_instance): """Query the license information of the vGPU instance. Args: @@ -22975,7 +23833,7 @@ cpdef unsigned int get_excluded_device_count() except? 0: return device_count -cpdef object get_excluded_device_info_by_index(unsigned int ind_ex) : +cpdef object get_excluded_device_info_by_index(unsigned int ind_ex): """Acquire the device information for an excluded GPU device, based on its ind_ex. Args: @@ -23035,7 +23893,7 @@ cpdef tuple device_get_mig_mode(intptr_t device): return (current_mode, pending_mode) -cpdef object device_get_gpu_instance_profile_info_v(intptr_t device, unsigned int profile) : +cpdef object device_get_gpu_instance_profile_info_v(intptr_t device, unsigned int profile): """Versioned wrapper around ``nvmlDeviceGetGpuInstanceProfileInfo`` that accepts a versioned ``nvmlGpuInstanceProfileInfo_v2_t`` or later output structure. Args: @@ -23169,7 +24027,7 @@ cpdef intptr_t device_get_gpu_instance_by_id(intptr_t device, unsigned int id) e return gpu_instance -cpdef object gpu_instance_get_info(intptr_t gpu_instance) : +cpdef object gpu_instance_get_info(intptr_t gpu_instance): """Get GPU instance information. Args: @@ -23188,7 +24046,7 @@ cpdef object gpu_instance_get_info(intptr_t gpu_instance) : return info_py -cpdef object gpu_instance_get_compute_instance_profile_info_v(intptr_t gpu_instance, unsigned int profile, unsigned int eng_profile) : +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. Args: @@ -23323,7 +24181,7 @@ cpdef intptr_t gpu_instance_get_compute_instance_by_id(intptr_t gpu_instance, un return compute_instance -cpdef object compute_instance_get_info_v2(intptr_t compute_instance) : +cpdef object compute_instance_get_info_v2(intptr_t compute_instance): """Get compute instance information. Args: @@ -23480,7 +24338,7 @@ cpdef gpm_mig_sample_get(intptr_t device, unsigned int gpu_instance_id, intptr_t check_status(__status__) -cpdef object gpm_query_device_support(intptr_t device) : +cpdef object gpm_query_device_support(intptr_t device): """Indicate whether the supplied device supports GPM. Args: @@ -23532,7 +24390,7 @@ cpdef gpm_set_streaming_enabled(intptr_t device, unsigned int state): check_status(__status__) -cpdef object device_get_capabilities(intptr_t device) : +cpdef object device_get_capabilities(intptr_t device): """Get device capabilities. Args: @@ -23608,7 +24466,7 @@ cpdef device_power_smoothing_set_state(intptr_t device, intptr_t state): check_status(__status__) -cpdef object device_get_addressing_mode(intptr_t device) : +cpdef object device_get_addressing_mode(intptr_t device): """Get the addressing mode for a given GPU. Addressing modes can be one of:. Args: @@ -23628,7 +24486,7 @@ cpdef object device_get_addressing_mode(intptr_t device) : return mode_py -cpdef object device_get_repair_status(intptr_t device) : +cpdef object device_get_repair_status(intptr_t device): """Get the repair status for TPC/Channel repair. Args: @@ -23648,7 +24506,7 @@ cpdef object device_get_repair_status(intptr_t device) : return repair_status_py -cpdef object device_get_power_mizer_mode_v1(intptr_t device) : +cpdef object device_get_power_mizer_mode_v1(intptr_t device): """Retrieves current power mizer mode on this device. Args: @@ -23681,7 +24539,7 @@ cpdef device_set_power_mizer_mode_v1(intptr_t device, intptr_t power_mizer_mode) check_status(__status__) -cpdef object device_get_pdi(intptr_t device) : +cpdef object device_get_pdi(intptr_t device): """Retrieves the Per Device Identifier (PDI) associated with this device. Args: @@ -23701,7 +24559,7 @@ cpdef object device_get_pdi(intptr_t device) : return pdi_py -cpdef object device_get_nv_link_info(intptr_t device) : +cpdef object device_get_nv_link_info(intptr_t device): """Query NVLINK information associated with this device. Args: @@ -23735,7 +24593,7 @@ cpdef device_read_write_prm_v1(intptr_t device, intptr_t buffer): check_status(__status__) -cpdef object device_get_gpu_instance_profile_info_by_id_v(intptr_t device, unsigned int profile_id) : +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_v2_t`` or later output structure. Args: @@ -24055,18 +24913,17 @@ cpdef str device_get_hostname_v1(intptr_t device): cdef FieldValue _cast_field_values(values): + if isinstance(values, FieldValue): + return values cdef FieldValue values_ cdef unsigned int valuesCount = len(values) - if isinstance(values, FieldValue): - values_ = values - else: - values_ = FieldValue(valuesCount) - for i, v in enumerate(values): - if isinstance(v, tuple): - values_[i].field_id = v[0] - values_[i].scope_id = v[1] - else: - values_[i].field_id = v + values_ = FieldValue(valuesCount) + for i, v in enumerate(values): + if isinstance(v, tuple): + values_[i].field_id = v[0] + values_[i].scope_id = v[1] + else: + values_[i].field_id = v return values_ From 586a4527c5572e1f6904563d962008a28c366dfd Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Mon, 1 Dec 2025 11:23:46 -0500 Subject: [PATCH 5/9] Make NVML work on Windows --- .../cuda/bindings/_internal/nvml_linux.pyx | 2 - .../cuda/bindings/_internal/nvml_windows.pyx | 123 ++++++++++++++---- cuda_bindings/tests/nvml/test_init.py | 3 + 3 files changed, 100 insertions(+), 28 deletions(-) diff --git a/cuda_bindings/cuda/bindings/_internal/nvml_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvml_linux.pyx index f047e7da00..e530fd32d8 100644 --- a/cuda_bindings/cuda/bindings/_internal/nvml_linux.pyx +++ b/cuda_bindings/cuda/bindings/_internal/nvml_linux.pyx @@ -411,8 +411,6 @@ cdef void* __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts = NULL cdef void* load_library() except* with gil: - # TODO: libnvidia-ml.so.1 ships with the driver so is in a different - # location than where pathfinder looks for it return dlopen("libnvidia-ml.so.1", RTLD_NOW | RTLD_GLOBAL) diff --git a/cuda_bindings/cuda/bindings/_internal/nvml_windows.pyx b/cuda_bindings/cuda/bindings/_internal/nvml_windows.pyx index a13ca0ab71..e82f926d15 100644 --- a/cuda_bindings/cuda/bindings/_internal/nvml_windows.pyx +++ b/cuda_bindings/cuda/bindings/_internal/nvml_windows.pyx @@ -6,25 +6,76 @@ from libc.stdint cimport intptr_t -from .utils cimport get_nvml_dso_version_suffix - import os -import site import threading -import win32api - from .utils import FunctionNotFoundError, NotSupportedError +from libc.stddef cimport wchar_t +from libc.stdint cimport uintptr_t +from cpython cimport PyUnicode_AsWideCharString, PyMem_Free + +# You must 'from .utils import NotSupportedError' before using this template + +cdef extern from "windows.h" nogil: + ctypedef void* HMODULE + ctypedef void* HANDLE + ctypedef void* FARPROC + ctypedef unsigned long DWORD + ctypedef const wchar_t *LPCWSTR + ctypedef const char *LPCSTR + + cdef DWORD LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800 + cdef DWORD LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 0x00001000 + cdef DWORD LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = 0x00000100 + + HMODULE _LoadLibraryExW "LoadLibraryExW"( + LPCWSTR lpLibFileName, + HANDLE hFile, + DWORD dwFlags + ) + + FARPROC _GetProcAddress "GetProcAddress"(HMODULE hModule, LPCSTR lpProcName) + +cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags): + cdef uintptr_t result + cdef wchar_t* wpath = PyUnicode_AsWideCharString(path, NULL) + with nogil: + result = _LoadLibraryExW( + wpath, + hFile, + dwFlags + ) + PyMem_Free(wpath) + return result + +cdef inline void *GetProcAddress(uintptr_t hModule, const char* lpProcName) nogil: + return _GetProcAddress(hModule, lpProcName) + +cdef int get_cuda_version(): + cdef int err, driver_ver = 0 + + # Load driver to check version + handle = LoadLibraryExW("nvcuda.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32) + if handle == 0: + raise NotSupportedError('CUDA driver is not found') + cuDriverGetVersion = GetProcAddress(handle, 'cuDriverGetVersion') + if cuDriverGetVersion == NULL: + raise RuntimeError('Did not find cuDriverGetVersion symbol in nvcuda.dll') + err = (cuDriverGetVersion)(&driver_ver) + if err != 0: + raise RuntimeError(f'cuDriverGetVersion returned error code {err}') + + return driver_ver + + ############################################################################### # Wrapper init ############################################################################### -LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800 cdef object __symbol_lock = threading.Lock() cdef bint __py_nvml_init = False -cdef void* __cuDriverGetVersion = NULL cdef void* __nvmlInit_v2 = NULL cdef void* __nvmlInitWithFlags = NULL @@ -376,30 +427,43 @@ cdef void* __nvmlDeviceGetGpuInstanceProfileInfoByIdV = NULL cdef void* __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts = NULL -cdef int _check_or_init_nvml() except -1 nogil: +cdef uintptr_t load_library() except* with gil: + def do_load(path): + return LoadLibraryExW( + path, + 0, + LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR + ) + + handle = do_load( + os.path.join( + os.getenv("WINDIR", "C:/Windows"), + "System32/nvml.dll" + ) + ) + if handle: + return handle + + handle = do_load( + os.path.join( + os.getenv("ProgramFiles", "C:/Program Files"), + "NVIDIA Corporation/NVSMI/nvml.dll" + ) + ) + if handle: + return handle + + return 0 + + +cdef int _init_nvml() except -1 nogil: global __py_nvml_init - if __py_nvml_init: - return 0 cdef int err, driver_ver = 0 + cdef uintptr_t handle with gil, __symbol_lock: - # Load driver to check version - try: - handle = win32api.LoadLibraryEx("nvcuda.dll", 0, LOAD_LIBRARY_SEARCH_SYSTEM32) - except Exception as e: - raise NotSupportedError(f'CUDA driver is not found ({e})') - global __cuDriverGetVersion - if __cuDriverGetVersion == NULL: - __cuDriverGetVersion = win32api.GetProcAddress(handle, 'cuDriverGetVersion') - if __cuDriverGetVersion == NULL: - raise RuntimeError('something went wrong') - err = (__cuDriverGetVersion)(&driver_ver) - if err != 0: - raise RuntimeError('something went wrong') - - # Load library - handle = load_nvidia_dynamic_lib("nvml")._handle_uint + handle = load_library() # Load function global __nvmlInit_v2 @@ -1450,6 +1514,13 @@ cdef int _check_or_init_nvml() except -1 nogil: return 0 +cdef inline int _check_or_init_nvml() except -1 nogil: + if __py_nvml_init: + return 0 + + return _init_nvml() + + cdef dict func_ptrs = None diff --git a/cuda_bindings/tests/nvml/test_init.py b/cuda_bindings/tests/nvml/test_init.py index b63aa7bbbe..ce6cead8cc 100644 --- a/cuda_bindings/tests/nvml/test_init.py +++ b/cuda_bindings/tests/nvml/test_init.py @@ -1,6 +1,8 @@ # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE +import sys + import pytest from cuda.bindings import nvml @@ -14,6 +16,7 @@ def assert_nvml_is_uninitialized(): nvml.device_get_count_v2() +@pytest.mark.skipif(sys.platform == "win32", reason="Test not supported on Windows") def test_init_ref_count(): """ Verifies that we can call NVML shutdown and init(2) multiple times, and that ref counting works From 315e12db94a7c0ab7e596c96920c7cad855fd88d Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Mon, 1 Dec 2025 14:09:00 -0500 Subject: [PATCH 6/9] Skip another test on Windows --- cuda_bindings/tests/nvml/test_compute_mode.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cuda_bindings/tests/nvml/test_compute_mode.py b/cuda_bindings/tests/nvml/test_compute_mode.py index 7bb450ab31..c76bbf1902 100644 --- a/cuda_bindings/tests/nvml/test_compute_mode.py +++ b/cuda_bindings/tests/nvml/test_compute_mode.py @@ -1,6 +1,9 @@ # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE + +import sys + import pytest from cuda.bindings import nvml @@ -11,6 +14,7 @@ ] +@pytest.mark.skipif(sys.platform == "win32", reason="Test not supported on Windows") def test_compute_mode_supported_nonroot(for_all_devices): device = for_all_devices From a176ebd78bd49ad8ad438046508ca2108e63d84a Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Mon, 1 Dec 2025 15:49:01 -0500 Subject: [PATCH 7/9] Free-threading fixes --- cuda_bindings/cuda/bindings/cufile.pyx | 96 +- cuda_bindings/cuda/bindings/nvml.pyx | 1106 ++++++++++++++++++++---- 2 files changed, 1001 insertions(+), 201 deletions(-) diff --git a/cuda_bindings/cuda/bindings/cufile.pyx b/cuda_bindings/cuda/bindings/cufile.pyx index ed370e5ec3..02f204b1f3 100644 --- a/cuda_bindings/cuda/bindings/cufile.pyx +++ b/cuda_bindings/cuda/bindings/cufile.pyx @@ -55,6 +55,7 @@ cdef class _py_anon_pod1: cdef: _anon_pod1 *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -62,11 +63,15 @@ cdef class _py_anon_pod1: if self._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef _anon_pod1 *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}._py_anon_pod1 object at {hex(id(self))}>" @@ -96,6 +101,7 @@ cdef class _py_anon_pod1: raise MemoryError("Error allocating _py_anon_pod1") memcpy(self._ptr, val.ctypes.data, sizeof((NULL).handle)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -149,9 +155,11 @@ cdef class _py_anon_pod1: raise MemoryError("Error allocating _py_anon_pod1") memcpy((obj._ptr), ptr, sizeof((NULL).handle)) obj._owner = None + obj._owned = True else: obj._ptr = <_anon_pod1 *>ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -181,6 +189,7 @@ cdef class _py_anon_pod3: cdef: _anon_pod3 *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -188,11 +197,15 @@ cdef class _py_anon_pod3: if self._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod3") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef _anon_pod3 *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}._py_anon_pod3 object at {hex(id(self))}>" @@ -222,6 +235,7 @@ cdef class _py_anon_pod3: raise MemoryError("Error allocating _py_anon_pod3") memcpy(self._ptr, val.ctypes.data, sizeof((NULL).u.batch)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -297,9 +311,11 @@ cdef class _py_anon_pod3: raise MemoryError("Error allocating _py_anon_pod3") memcpy((obj._ptr), ptr, sizeof((NULL).u.batch)) obj._owner = None + obj._owned = True else: obj._ptr = <_anon_pod3 *>ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -485,6 +501,7 @@ cdef class OpCounter: cdef: CUfileOpCounter_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -492,11 +509,15 @@ cdef class OpCounter: if self._ptr == NULL: raise MemoryError("Error allocating OpCounter") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef CUfileOpCounter_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.OpCounter object at {hex(id(self))}>" @@ -526,6 +547,7 @@ cdef class OpCounter: raise MemoryError("Error allocating OpCounter") memcpy(self._ptr, val.ctypes.data, sizeof(CUfileOpCounter_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -579,9 +601,11 @@ cdef class OpCounter: raise MemoryError("Error allocating OpCounter") memcpy((obj._ptr), ptr, sizeof(CUfileOpCounter_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -637,6 +661,7 @@ cdef class PerGpuStats: cdef: CUfilePerGpuStats_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -644,11 +669,15 @@ cdef class PerGpuStats: if self._ptr == NULL: raise MemoryError("Error allocating PerGpuStats") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef CUfilePerGpuStats_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.PerGpuStats object at {hex(id(self))}>" @@ -678,6 +707,7 @@ cdef class PerGpuStats: raise MemoryError("Error allocating PerGpuStats") memcpy(self._ptr, val.ctypes.data, sizeof(CUfilePerGpuStats_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -1043,9 +1073,11 @@ cdef class PerGpuStats: raise MemoryError("Error allocating PerGpuStats") memcpy((obj._ptr), ptr, sizeof(CUfilePerGpuStats_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -1237,6 +1269,7 @@ cdef class _py_anon_pod2: cdef: _anon_pod2 *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -1244,11 +1277,15 @@ cdef class _py_anon_pod2: if self._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod2") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef _anon_pod2 *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}._py_anon_pod2 object at {hex(id(self))}>" @@ -1278,6 +1315,7 @@ cdef class _py_anon_pod2: raise MemoryError("Error allocating _py_anon_pod2") memcpy(self._ptr, val.ctypes.data, sizeof((NULL).u)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -1321,9 +1359,11 @@ cdef class _py_anon_pod2: raise MemoryError("Error allocating _py_anon_pod2") memcpy((obj._ptr), ptr, sizeof((NULL).u)) obj._owner = None + obj._owned = True else: obj._ptr = <_anon_pod2 *>ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -1392,6 +1432,7 @@ cdef class StatsLevel1: cdef: CUfileStatsLevel1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -1399,11 +1440,15 @@ cdef class StatsLevel1: if self._ptr == NULL: raise MemoryError("Error allocating StatsLevel1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef CUfileStatsLevel1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.StatsLevel1 object at {hex(id(self))}>" @@ -1433,6 +1478,7 @@ cdef class StatsLevel1: raise MemoryError("Error allocating StatsLevel1") memcpy(self._ptr, val.ctypes.data, sizeof(CUfileStatsLevel1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -1958,9 +2004,11 @@ cdef class StatsLevel1: raise MemoryError("Error allocating StatsLevel1") memcpy((obj._ptr), ptr, sizeof(CUfileStatsLevel1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -2183,6 +2231,7 @@ cdef class StatsLevel2: cdef: CUfileStatsLevel2_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -2190,11 +2239,15 @@ cdef class StatsLevel2: if self._ptr == NULL: raise MemoryError("Error allocating StatsLevel2") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef CUfileStatsLevel2_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.StatsLevel2 object at {hex(id(self))}>" @@ -2224,6 +2277,7 @@ cdef class StatsLevel2: raise MemoryError("Error allocating StatsLevel2") memcpy(self._ptr, val.ctypes.data, sizeof(CUfileStatsLevel2_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -2297,9 +2351,11 @@ cdef class StatsLevel2: raise MemoryError("Error allocating StatsLevel2") memcpy((obj._ptr), ptr, sizeof(CUfileStatsLevel2_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -2328,6 +2384,7 @@ cdef class StatsLevel3: cdef: CUfileStatsLevel3_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -2335,11 +2392,15 @@ cdef class StatsLevel3: if self._ptr == NULL: raise MemoryError("Error allocating StatsLevel3") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef CUfileStatsLevel3_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.StatsLevel3 object at {hex(id(self))}>" @@ -2369,6 +2430,7 @@ cdef class StatsLevel3: raise MemoryError("Error allocating StatsLevel3") memcpy(self._ptr, val.ctypes.data, sizeof(CUfileStatsLevel3_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -2437,9 +2499,11 @@ cdef class StatsLevel3: raise MemoryError("Error allocating StatsLevel3") memcpy((obj._ptr), ptr, sizeof(CUfileStatsLevel3_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj diff --git a/cuda_bindings/cuda/bindings/nvml.pyx b/cuda_bindings/cuda/bindings/nvml.pyx index a7a695f7c2..b83dcb8813 100644 --- a/cuda_bindings/cuda/bindings/nvml.pyx +++ b/cuda_bindings/cuda/bindings/nvml.pyx @@ -1353,6 +1353,7 @@ cdef class PciInfoExt_v1: cdef: nvmlPciInfoExt_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -1360,11 +1361,15 @@ cdef class PciInfoExt_v1: if self._ptr == NULL: raise MemoryError("Error allocating PciInfoExt_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlPciInfoExt_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.PciInfoExt_v1 object at {hex(id(self))}>" @@ -1394,6 +1399,7 @@ cdef class PciInfoExt_v1: raise MemoryError("Error allocating PciInfoExt_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPciInfoExt_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -1528,9 +1534,11 @@ cdef class PciInfoExt_v1: raise MemoryError("Error allocating PciInfoExt_v1") memcpy((obj._ptr), ptr, sizeof(nvmlPciInfoExt_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -1563,6 +1571,7 @@ cdef class PciInfo: cdef: nvmlPciInfo_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -1570,11 +1579,15 @@ cdef class PciInfo: if self._ptr == NULL: raise MemoryError("Error allocating PciInfo") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlPciInfo_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.PciInfo object at {hex(id(self))}>" @@ -1604,6 +1617,7 @@ cdef class PciInfo: raise MemoryError("Error allocating PciInfo") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPciInfo_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -1720,9 +1734,11 @@ cdef class PciInfo: raise MemoryError("Error allocating PciInfo") memcpy((obj._ptr), ptr, sizeof(nvmlPciInfo_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -1750,6 +1766,7 @@ cdef class Utilization: cdef: nvmlUtilization_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -1757,11 +1774,15 @@ cdef class Utilization: if self._ptr == NULL: raise MemoryError("Error allocating Utilization") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlUtilization_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.Utilization object at {hex(id(self))}>" @@ -1791,6 +1812,7 @@ cdef class Utilization: raise MemoryError("Error allocating Utilization") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlUtilization_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -1844,9 +1866,11 @@ cdef class Utilization: raise MemoryError("Error allocating Utilization") memcpy((obj._ptr), ptr, sizeof(nvmlUtilization_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -1875,6 +1899,7 @@ cdef class Memory: cdef: nvmlMemory_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -1882,11 +1907,15 @@ cdef class Memory: if self._ptr == NULL: raise MemoryError("Error allocating Memory") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlMemory_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.Memory object at {hex(id(self))}>" @@ -1916,6 +1945,7 @@ cdef class Memory: raise MemoryError("Error allocating Memory") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlMemory_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -1980,9 +2010,11 @@ cdef class Memory: raise MemoryError("Error allocating Memory") memcpy((obj._ptr), ptr, sizeof(nvmlMemory_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -2013,6 +2045,7 @@ cdef class Memory_v2: cdef: nvmlMemory_v2_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -2020,11 +2053,15 @@ cdef class Memory_v2: if self._ptr == NULL: raise MemoryError("Error allocating Memory_v2") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlMemory_v2_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.Memory_v2 object at {hex(id(self))}>" @@ -2054,6 +2091,7 @@ cdef class Memory_v2: raise MemoryError("Error allocating Memory_v2") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlMemory_v2_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -2129,9 +2167,11 @@ cdef class Memory_v2: raise MemoryError("Error allocating Memory_v2") memcpy((obj._ptr), ptr, sizeof(nvmlMemory_v2_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -2160,6 +2200,7 @@ cdef class BAR1Memory: cdef: nvmlBAR1Memory_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -2167,11 +2208,15 @@ cdef class BAR1Memory: if self._ptr == NULL: raise MemoryError("Error allocating BAR1Memory") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlBAR1Memory_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.BAR1Memory object at {hex(id(self))}>" @@ -2201,6 +2246,7 @@ cdef class BAR1Memory: raise MemoryError("Error allocating BAR1Memory") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlBAR1Memory_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -2265,9 +2311,11 @@ cdef class BAR1Memory: raise MemoryError("Error allocating BAR1Memory") memcpy((obj._ptr), ptr, sizeof(nvmlBAR1Memory_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -2654,6 +2702,7 @@ cdef class DeviceAttributes: cdef: nvmlDeviceAttributes_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -2661,11 +2710,15 @@ cdef class DeviceAttributes: if self._ptr == NULL: raise MemoryError("Error allocating DeviceAttributes") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlDeviceAttributes_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.DeviceAttributes object at {hex(id(self))}>" @@ -2695,6 +2748,7 @@ cdef class DeviceAttributes: raise MemoryError("Error allocating DeviceAttributes") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlDeviceAttributes_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -2825,9 +2879,11 @@ cdef class DeviceAttributes: raise MemoryError("Error allocating DeviceAttributes") memcpy((obj._ptr), ptr, sizeof(nvmlDeviceAttributes_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -2854,6 +2910,7 @@ cdef class C2cModeInfo_v1: cdef: nvmlC2cModeInfo_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -2861,11 +2918,15 @@ cdef class C2cModeInfo_v1: if self._ptr == NULL: raise MemoryError("Error allocating C2cModeInfo_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlC2cModeInfo_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.C2cModeInfo_v1 object at {hex(id(self))}>" @@ -2895,6 +2956,7 @@ cdef class C2cModeInfo_v1: raise MemoryError("Error allocating C2cModeInfo_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlC2cModeInfo_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -2937,9 +2999,11 @@ cdef class C2cModeInfo_v1: raise MemoryError("Error allocating C2cModeInfo_v1") memcpy((obj._ptr), ptr, sizeof(nvmlC2cModeInfo_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -2970,6 +3034,7 @@ cdef class RowRemapperHistogramValues: cdef: nvmlRowRemapperHistogramValues_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -2977,11 +3042,15 @@ cdef class RowRemapperHistogramValues: if self._ptr == NULL: raise MemoryError("Error allocating RowRemapperHistogramValues") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlRowRemapperHistogramValues_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.RowRemapperHistogramValues object at {hex(id(self))}>" @@ -3011,6 +3080,7 @@ cdef class RowRemapperHistogramValues: raise MemoryError("Error allocating RowRemapperHistogramValues") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlRowRemapperHistogramValues_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -3097,9 +3167,11 @@ cdef class RowRemapperHistogramValues: raise MemoryError("Error allocating RowRemapperHistogramValues") memcpy((obj._ptr), ptr, sizeof(nvmlRowRemapperHistogramValues_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -3273,6 +3345,7 @@ cdef class Value: cdef: nvmlValue_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -3280,11 +3353,15 @@ cdef class Value: if self._ptr == NULL: raise MemoryError("Error allocating Value") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlValue_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.Value object at {hex(id(self))}>" @@ -3314,6 +3391,7 @@ cdef class Value: raise MemoryError("Error allocating Value") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlValue_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -3422,9 +3500,11 @@ cdef class Value: raise MemoryError("Error allocating Value") memcpy((obj._ptr), ptr, sizeof(nvmlValue_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -3455,6 +3535,7 @@ cdef class _py_anon_pod0: cdef: _anon_pod0 *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -3462,11 +3543,15 @@ cdef class _py_anon_pod0: if self._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod0") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef _anon_pod0 *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}._py_anon_pod0 object at {hex(id(self))}>" @@ -3496,6 +3581,7 @@ cdef class _py_anon_pod0: raise MemoryError("Error allocating _py_anon_pod0") memcpy(self._ptr, val.ctypes.data, sizeof(_anon_pod0)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -3582,9 +3668,11 @@ cdef class _py_anon_pod0: raise MemoryError("Error allocating _py_anon_pod0") memcpy((obj._ptr), ptr, sizeof(_anon_pod0)) obj._owner = None + obj._owned = True else: obj._ptr = <_anon_pod0 *>ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -3614,6 +3702,7 @@ cdef class CoolerInfo_v1: cdef: nvmlCoolerInfo_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -3621,11 +3710,15 @@ cdef class CoolerInfo_v1: if self._ptr == NULL: raise MemoryError("Error allocating CoolerInfo_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlCoolerInfo_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.CoolerInfo_v1 object at {hex(id(self))}>" @@ -3655,6 +3748,7 @@ cdef class CoolerInfo_v1: raise MemoryError("Error allocating CoolerInfo_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlCoolerInfo_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -3730,9 +3824,11 @@ cdef class CoolerInfo_v1: raise MemoryError("Error allocating CoolerInfo_v1") memcpy((obj._ptr), ptr, sizeof(nvmlCoolerInfo_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -3760,6 +3856,7 @@ cdef class MarginTemperature_v1: cdef: nvmlMarginTemperature_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -3767,11 +3864,15 @@ cdef class MarginTemperature_v1: if self._ptr == NULL: raise MemoryError("Error allocating MarginTemperature_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlMarginTemperature_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.MarginTemperature_v1 object at {hex(id(self))}>" @@ -3801,6 +3902,7 @@ cdef class MarginTemperature_v1: raise MemoryError("Error allocating MarginTemperature_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlMarginTemperature_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -3854,9 +3956,11 @@ cdef class MarginTemperature_v1: raise MemoryError("Error allocating MarginTemperature_v1") memcpy((obj._ptr), ptr, sizeof(nvmlMarginTemperature_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -4034,6 +4138,7 @@ cdef class ClockOffset_v1: cdef: nvmlClockOffset_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -4041,11 +4146,15 @@ cdef class ClockOffset_v1: if self._ptr == NULL: raise MemoryError("Error allocating ClockOffset_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlClockOffset_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.ClockOffset_v1 object at {hex(id(self))}>" @@ -4075,6 +4184,7 @@ cdef class ClockOffset_v1: raise MemoryError("Error allocating ClockOffset_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlClockOffset_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -4172,9 +4282,11 @@ cdef class ClockOffset_v1: raise MemoryError("Error allocating ClockOffset_v1") memcpy((obj._ptr), ptr, sizeof(nvmlClockOffset_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -4203,6 +4315,7 @@ cdef class FanSpeedInfo_v1: cdef: nvmlFanSpeedInfo_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -4210,11 +4323,15 @@ cdef class FanSpeedInfo_v1: if self._ptr == NULL: raise MemoryError("Error allocating FanSpeedInfo_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlFanSpeedInfo_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.FanSpeedInfo_v1 object at {hex(id(self))}>" @@ -4244,6 +4361,7 @@ cdef class FanSpeedInfo_v1: raise MemoryError("Error allocating FanSpeedInfo_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlFanSpeedInfo_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -4308,9 +4426,11 @@ cdef class FanSpeedInfo_v1: raise MemoryError("Error allocating FanSpeedInfo_v1") memcpy((obj._ptr), ptr, sizeof(nvmlFanSpeedInfo_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -4338,6 +4458,7 @@ cdef class DevicePerfModes_v1: cdef: nvmlDevicePerfModes_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -4345,11 +4466,15 @@ cdef class DevicePerfModes_v1: if self._ptr == NULL: raise MemoryError("Error allocating DevicePerfModes_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlDevicePerfModes_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.DevicePerfModes_v1 object at {hex(id(self))}>" @@ -4379,6 +4504,7 @@ cdef class DevicePerfModes_v1: raise MemoryError("Error allocating DevicePerfModes_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlDevicePerfModes_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -4436,9 +4562,11 @@ cdef class DevicePerfModes_v1: raise MemoryError("Error allocating DevicePerfModes_v1") memcpy((obj._ptr), ptr, sizeof(nvmlDevicePerfModes_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -4466,6 +4594,7 @@ cdef class DeviceCurrentClockFreqs_v1: cdef: nvmlDeviceCurrentClockFreqs_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -4473,11 +4602,15 @@ cdef class DeviceCurrentClockFreqs_v1: if self._ptr == NULL: raise MemoryError("Error allocating DeviceCurrentClockFreqs_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlDeviceCurrentClockFreqs_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.DeviceCurrentClockFreqs_v1 object at {hex(id(self))}>" @@ -4507,6 +4640,7 @@ cdef class DeviceCurrentClockFreqs_v1: raise MemoryError("Error allocating DeviceCurrentClockFreqs_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlDeviceCurrentClockFreqs_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -4564,9 +4698,11 @@ cdef class DeviceCurrentClockFreqs_v1: raise MemoryError("Error allocating DeviceCurrentClockFreqs_v1") memcpy((obj._ptr), ptr, sizeof(nvmlDeviceCurrentClockFreqs_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -5017,6 +5153,7 @@ cdef class EccSramErrorStatus_v1: cdef: nvmlEccSramErrorStatus_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -5024,11 +5161,15 @@ cdef class EccSramErrorStatus_v1: if self._ptr == NULL: raise MemoryError("Error allocating EccSramErrorStatus_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlEccSramErrorStatus_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.EccSramErrorStatus_v1 object at {hex(id(self))}>" @@ -5058,6 +5199,7 @@ cdef class EccSramErrorStatus_v1: raise MemoryError("Error allocating EccSramErrorStatus_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlEccSramErrorStatus_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -5232,9 +5374,11 @@ cdef class EccSramErrorStatus_v1: raise MemoryError("Error allocating EccSramErrorStatus_v1") memcpy((obj._ptr), ptr, sizeof(nvmlEccSramErrorStatus_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -5268,6 +5412,7 @@ cdef class PlatformInfo_v2: cdef: nvmlPlatformInfo_v2_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -5275,11 +5420,15 @@ cdef class PlatformInfo_v2: if self._ptr == NULL: raise MemoryError("Error allocating PlatformInfo_v2") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlPlatformInfo_v2_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.PlatformInfo_v2 object at {hex(id(self))}>" @@ -5309,6 +5458,7 @@ cdef class PlatformInfo_v2: raise MemoryError("Error allocating PlatformInfo_v2") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPlatformInfo_v2_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -5436,9 +5586,11 @@ cdef class PlatformInfo_v2: raise MemoryError("Error allocating PlatformInfo_v2") memcpy((obj._ptr), ptr, sizeof(nvmlPlatformInfo_v2_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -5468,6 +5620,7 @@ cdef class _py_anon_pod1: cdef: _anon_pod1 *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -5475,11 +5628,15 @@ cdef class _py_anon_pod1: if self._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef _anon_pod1 *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}._py_anon_pod1 object at {hex(id(self))}>" @@ -5509,6 +5666,7 @@ cdef class _py_anon_pod1: raise MemoryError("Error allocating _py_anon_pod1") memcpy(self._ptr, val.ctypes.data, sizeof(_anon_pod1)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -5584,9 +5742,11 @@ cdef class _py_anon_pod1: raise MemoryError("Error allocating _py_anon_pod1") memcpy((obj._ptr), ptr, sizeof(_anon_pod1)) obj._owner = None + obj._owned = True else: obj._ptr = <_anon_pod1 *>ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -5614,6 +5774,7 @@ cdef class VgpuHeterogeneousMode_v1: cdef: nvmlVgpuHeterogeneousMode_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -5621,11 +5782,15 @@ cdef class VgpuHeterogeneousMode_v1: if self._ptr == NULL: raise MemoryError("Error allocating VgpuHeterogeneousMode_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuHeterogeneousMode_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuHeterogeneousMode_v1 object at {hex(id(self))}>" @@ -5655,6 +5820,7 @@ cdef class VgpuHeterogeneousMode_v1: raise MemoryError("Error allocating VgpuHeterogeneousMode_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuHeterogeneousMode_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -5708,9 +5874,11 @@ cdef class VgpuHeterogeneousMode_v1: raise MemoryError("Error allocating VgpuHeterogeneousMode_v1") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuHeterogeneousMode_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -5738,6 +5906,7 @@ cdef class VgpuPlacementId_v1: cdef: nvmlVgpuPlacementId_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -5745,11 +5914,15 @@ cdef class VgpuPlacementId_v1: if self._ptr == NULL: raise MemoryError("Error allocating VgpuPlacementId_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuPlacementId_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuPlacementId_v1 object at {hex(id(self))}>" @@ -5779,6 +5952,7 @@ cdef class VgpuPlacementId_v1: raise MemoryError("Error allocating VgpuPlacementId_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuPlacementId_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -5832,9 +6006,11 @@ cdef class VgpuPlacementId_v1: raise MemoryError("Error allocating VgpuPlacementId_v1") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuPlacementId_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -5865,6 +6041,7 @@ cdef class VgpuPlacementList_v2: cdef: nvmlVgpuPlacementList_v2_t *_ptr object _owner + bint _owned bint _readonly dict _refs @@ -5873,12 +6050,16 @@ cdef class VgpuPlacementList_v2: if self._ptr == NULL: raise MemoryError("Error allocating VgpuPlacementList_v2") self._owner = None + self._owned = True self._readonly = False self._refs = {} def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuPlacementList_v2_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuPlacementList_v2 object at {hex(id(self))}>" @@ -5908,6 +6089,7 @@ cdef class VgpuPlacementList_v2: raise MemoryError("Error allocating VgpuPlacementList_v2") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuPlacementList_v2_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -5991,9 +6173,11 @@ cdef class VgpuPlacementList_v2: raise MemoryError("Error allocating VgpuPlacementList_v2") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuPlacementList_v2_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -6022,6 +6206,7 @@ cdef class VgpuTypeBar1Info_v1: cdef: nvmlVgpuTypeBar1Info_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -6029,11 +6214,15 @@ cdef class VgpuTypeBar1Info_v1: if self._ptr == NULL: raise MemoryError("Error allocating VgpuTypeBar1Info_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuTypeBar1Info_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuTypeBar1Info_v1 object at {hex(id(self))}>" @@ -6063,6 +6252,7 @@ cdef class VgpuTypeBar1Info_v1: raise MemoryError("Error allocating VgpuTypeBar1Info_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuTypeBar1Info_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -6116,9 +6306,11 @@ cdef class VgpuTypeBar1Info_v1: raise MemoryError("Error allocating VgpuTypeBar1Info_v1") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuTypeBar1Info_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -6386,6 +6578,7 @@ cdef class VgpuRuntimeState_v1: cdef: nvmlVgpuRuntimeState_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -6393,11 +6586,15 @@ cdef class VgpuRuntimeState_v1: if self._ptr == NULL: raise MemoryError("Error allocating VgpuRuntimeState_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuRuntimeState_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuRuntimeState_v1 object at {hex(id(self))}>" @@ -6427,6 +6624,7 @@ cdef class VgpuRuntimeState_v1: raise MemoryError("Error allocating VgpuRuntimeState_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuRuntimeState_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -6480,9 +6678,11 @@ cdef class VgpuRuntimeState_v1: raise MemoryError("Error allocating VgpuRuntimeState_v1") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuRuntimeState_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -6510,6 +6710,7 @@ cdef class _py_anon_pod2: cdef: _anon_pod2 *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -6517,11 +6718,15 @@ cdef class _py_anon_pod2: if self._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod2") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef _anon_pod2 *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}._py_anon_pod2 object at {hex(id(self))}>" @@ -6551,6 +6756,7 @@ cdef class _py_anon_pod2: raise MemoryError("Error allocating _py_anon_pod2") memcpy(self._ptr, val.ctypes.data, sizeof(_anon_pod2)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -6604,9 +6810,11 @@ cdef class _py_anon_pod2: raise MemoryError("Error allocating _py_anon_pod2") memcpy((obj._ptr), ptr, sizeof(_anon_pod2)) obj._owner = None + obj._owned = True else: obj._ptr = <_anon_pod2 *>ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -6633,6 +6841,7 @@ cdef class _py_anon_pod3: cdef: _anon_pod3 *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -6640,11 +6849,15 @@ cdef class _py_anon_pod3: if self._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod3") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef _anon_pod3 *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}._py_anon_pod3 object at {hex(id(self))}>" @@ -6674,6 +6887,7 @@ cdef class _py_anon_pod3: raise MemoryError("Error allocating _py_anon_pod3") memcpy(self._ptr, val.ctypes.data, sizeof(_anon_pod3)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -6716,9 +6930,11 @@ cdef class _py_anon_pod3: raise MemoryError("Error allocating _py_anon_pod3") memcpy((obj._ptr), ptr, sizeof(_anon_pod3)) obj._owner = None + obj._owned = True else: obj._ptr = <_anon_pod3 *>ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -6940,6 +7156,7 @@ cdef class _py_anon_pod4: cdef: _anon_pod4 *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -6947,11 +7164,15 @@ cdef class _py_anon_pod4: if self._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod4") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef _anon_pod4 *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}._py_anon_pod4 object at {hex(id(self))}>" @@ -6981,6 +7202,7 @@ cdef class _py_anon_pod4: raise MemoryError("Error allocating _py_anon_pod4") memcpy(self._ptr, val.ctypes.data, sizeof(_anon_pod4)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -7034,9 +7256,11 @@ cdef class _py_anon_pod4: raise MemoryError("Error allocating _py_anon_pod4") memcpy((obj._ptr), ptr, sizeof(_anon_pod4)) obj._owner = None + obj._owned = True else: obj._ptr = <_anon_pod4 *>ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -7063,6 +7287,7 @@ cdef class _py_anon_pod5: cdef: _anon_pod5 *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -7070,11 +7295,15 @@ cdef class _py_anon_pod5: if self._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod5") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef _anon_pod5 *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}._py_anon_pod5 object at {hex(id(self))}>" @@ -7104,6 +7333,7 @@ cdef class _py_anon_pod5: raise MemoryError("Error allocating _py_anon_pod5") memcpy(self._ptr, val.ctypes.data, sizeof(_anon_pod5)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -7146,9 +7376,11 @@ cdef class _py_anon_pod5: raise MemoryError("Error allocating _py_anon_pod5") memcpy((obj._ptr), ptr, sizeof(_anon_pod5)) obj._owner = None + obj._owned = True else: obj._ptr = <_anon_pod5 *>ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -7182,6 +7414,7 @@ cdef class VgpuSchedulerCapabilities: cdef: nvmlVgpuSchedulerCapabilities_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -7189,11 +7422,15 @@ cdef class VgpuSchedulerCapabilities: if self._ptr == NULL: raise MemoryError("Error allocating VgpuSchedulerCapabilities") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuSchedulerCapabilities_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuSchedulerCapabilities object at {hex(id(self))}>" @@ -7223,6 +7460,7 @@ cdef class VgpuSchedulerCapabilities: raise MemoryError("Error allocating VgpuSchedulerCapabilities") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerCapabilities_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -7346,9 +7584,11 @@ cdef class VgpuSchedulerCapabilities: raise MemoryError("Error allocating VgpuSchedulerCapabilities") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerCapabilities_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -7381,6 +7621,7 @@ cdef class VgpuLicenseExpiry: cdef: nvmlVgpuLicenseExpiry_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -7388,11 +7629,15 @@ cdef class VgpuLicenseExpiry: if self._ptr == NULL: raise MemoryError("Error allocating VgpuLicenseExpiry") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuLicenseExpiry_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuLicenseExpiry object at {hex(id(self))}>" @@ -7422,6 +7667,7 @@ cdef class VgpuLicenseExpiry: raise MemoryError("Error allocating VgpuLicenseExpiry") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuLicenseExpiry_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -7530,9 +7776,11 @@ cdef class VgpuLicenseExpiry: raise MemoryError("Error allocating VgpuLicenseExpiry") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuLicenseExpiry_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -7565,6 +7813,7 @@ cdef class GridLicenseExpiry: cdef: nvmlGridLicenseExpiry_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -7572,11 +7821,15 @@ cdef class GridLicenseExpiry: if self._ptr == NULL: raise MemoryError("Error allocating GridLicenseExpiry") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlGridLicenseExpiry_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.GridLicenseExpiry object at {hex(id(self))}>" @@ -7606,6 +7859,7 @@ cdef class GridLicenseExpiry: raise MemoryError("Error allocating GridLicenseExpiry") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGridLicenseExpiry_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -7714,9 +7968,11 @@ cdef class GridLicenseExpiry: raise MemoryError("Error allocating GridLicenseExpiry") memcpy((obj._ptr), ptr, sizeof(nvmlGridLicenseExpiry_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -7745,6 +8001,7 @@ cdef class VgpuTypeIdInfo_v1: cdef: nvmlVgpuTypeIdInfo_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -7752,11 +8009,15 @@ cdef class VgpuTypeIdInfo_v1: if self._ptr == NULL: raise MemoryError("Error allocating VgpuTypeIdInfo_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuTypeIdInfo_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuTypeIdInfo_v1 object at {hex(id(self))}>" @@ -7786,6 +8047,7 @@ cdef class VgpuTypeIdInfo_v1: raise MemoryError("Error allocating VgpuTypeIdInfo_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuTypeIdInfo_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -7839,9 +8101,11 @@ cdef class VgpuTypeIdInfo_v1: raise MemoryError("Error allocating VgpuTypeIdInfo_v1") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuTypeIdInfo_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -7870,6 +8134,7 @@ cdef class VgpuTypeMaxInstance_v1: cdef: nvmlVgpuTypeMaxInstance_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -7877,11 +8142,15 @@ cdef class VgpuTypeMaxInstance_v1: if self._ptr == NULL: raise MemoryError("Error allocating VgpuTypeMaxInstance_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuTypeMaxInstance_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuTypeMaxInstance_v1 object at {hex(id(self))}>" @@ -7911,6 +8180,7 @@ cdef class VgpuTypeMaxInstance_v1: raise MemoryError("Error allocating VgpuTypeMaxInstance_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuTypeMaxInstance_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -7975,9 +8245,11 @@ cdef class VgpuTypeMaxInstance_v1: raise MemoryError("Error allocating VgpuTypeMaxInstance_v1") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuTypeMaxInstance_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -8006,6 +8278,7 @@ cdef class ActiveVgpuInstanceInfo_v1: cdef: nvmlActiveVgpuInstanceInfo_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -8013,11 +8286,15 @@ cdef class ActiveVgpuInstanceInfo_v1: if self._ptr == NULL: raise MemoryError("Error allocating ActiveVgpuInstanceInfo_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlActiveVgpuInstanceInfo_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.ActiveVgpuInstanceInfo_v1 object at {hex(id(self))}>" @@ -8047,6 +8324,7 @@ cdef class ActiveVgpuInstanceInfo_v1: raise MemoryError("Error allocating ActiveVgpuInstanceInfo_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -8100,9 +8378,11 @@ cdef class ActiveVgpuInstanceInfo_v1: raise MemoryError("Error allocating ActiveVgpuInstanceInfo_v1") memcpy((obj._ptr), ptr, sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -8133,6 +8413,7 @@ cdef class VgpuCreatablePlacementInfo_v1: cdef: nvmlVgpuCreatablePlacementInfo_v1_t *_ptr object _owner + bint _owned bint _readonly dict _refs @@ -8141,12 +8422,16 @@ cdef class VgpuCreatablePlacementInfo_v1: if self._ptr == NULL: raise MemoryError("Error allocating VgpuCreatablePlacementInfo_v1") self._owner = None + self._owned = True self._readonly = False self._refs = {} def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuCreatablePlacementInfo_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuCreatablePlacementInfo_v1 object at {hex(id(self))}>" @@ -8176,6 +8461,7 @@ cdef class VgpuCreatablePlacementInfo_v1: raise MemoryError("Error allocating VgpuCreatablePlacementInfo_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -8259,9 +8545,11 @@ cdef class VgpuCreatablePlacementInfo_v1: raise MemoryError("Error allocating VgpuCreatablePlacementInfo_v1") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -8434,6 +8722,7 @@ cdef class LedState: cdef: nvmlLedState_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -8441,11 +8730,15 @@ cdef class LedState: if self._ptr == NULL: raise MemoryError("Error allocating LedState") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlLedState_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.LedState object at {hex(id(self))}>" @@ -8475,6 +8768,7 @@ cdef class LedState: raise MemoryError("Error allocating LedState") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlLedState_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -8532,9 +8826,11 @@ cdef class LedState: raise MemoryError("Error allocating LedState") memcpy((obj._ptr), ptr, sizeof(nvmlLedState_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -8564,6 +8860,7 @@ cdef class UnitInfo: cdef: nvmlUnitInfo_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -8571,11 +8868,15 @@ cdef class UnitInfo: if self._ptr == NULL: raise MemoryError("Error allocating UnitInfo") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlUnitInfo_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.UnitInfo object at {hex(id(self))}>" @@ -8605,6 +8906,7 @@ cdef class UnitInfo: raise MemoryError("Error allocating UnitInfo") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlUnitInfo_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -8696,9 +8998,11 @@ cdef class UnitInfo: raise MemoryError("Error allocating UnitInfo") memcpy((obj._ptr), ptr, sizeof(nvmlUnitInfo_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -8728,6 +9032,7 @@ cdef class PSUInfo: cdef: nvmlPSUInfo_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -8735,11 +9040,15 @@ cdef class PSUInfo: if self._ptr == NULL: raise MemoryError("Error allocating PSUInfo") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlPSUInfo_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.PSUInfo object at {hex(id(self))}>" @@ -8769,6 +9078,7 @@ cdef class PSUInfo: raise MemoryError("Error allocating PSUInfo") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPSUInfo_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -8848,9 +9158,11 @@ cdef class PSUInfo: raise MemoryError("Error allocating PSUInfo") memcpy((obj._ptr), ptr, sizeof(nvmlPSUInfo_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -9027,6 +9339,7 @@ cdef class EventData: cdef: nvmlEventData_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -9034,11 +9347,15 @@ cdef class EventData: if self._ptr == NULL: raise MemoryError("Error allocating EventData") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlEventData_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.EventData object at {hex(id(self))}>" @@ -9068,6 +9385,7 @@ cdef class EventData: raise MemoryError("Error allocating EventData") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlEventData_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -9154,9 +9472,11 @@ cdef class EventData: raise MemoryError("Error allocating EventData") memcpy((obj._ptr), ptr, sizeof(nvmlEventData_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -9189,6 +9509,7 @@ cdef class AccountingStats: cdef: nvmlAccountingStats_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -9196,11 +9517,15 @@ cdef class AccountingStats: if self._ptr == NULL: raise MemoryError("Error allocating AccountingStats") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlAccountingStats_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.AccountingStats object at {hex(id(self))}>" @@ -9230,6 +9555,7 @@ cdef class AccountingStats: raise MemoryError("Error allocating AccountingStats") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlAccountingStats_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -9327,9 +9653,11 @@ cdef class AccountingStats: raise MemoryError("Error allocating AccountingStats") memcpy((obj._ptr), ptr, sizeof(nvmlAccountingStats_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -9576,6 +9904,7 @@ cdef class FBCStats: cdef: nvmlFBCStats_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -9583,11 +9912,15 @@ cdef class FBCStats: if self._ptr == NULL: raise MemoryError("Error allocating FBCStats") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlFBCStats_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.FBCStats object at {hex(id(self))}>" @@ -9617,6 +9950,7 @@ cdef class FBCStats: raise MemoryError("Error allocating FBCStats") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlFBCStats_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -9681,9 +10015,11 @@ cdef class FBCStats: raise MemoryError("Error allocating FBCStats") memcpy((obj._ptr), ptr, sizeof(nvmlFBCStats_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -9977,6 +10313,7 @@ cdef class ConfComputeSystemCaps: cdef: nvmlConfComputeSystemCaps_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -9984,11 +10321,15 @@ cdef class ConfComputeSystemCaps: if self._ptr == NULL: raise MemoryError("Error allocating ConfComputeSystemCaps") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlConfComputeSystemCaps_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.ConfComputeSystemCaps object at {hex(id(self))}>" @@ -10018,6 +10359,7 @@ cdef class ConfComputeSystemCaps: raise MemoryError("Error allocating ConfComputeSystemCaps") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeSystemCaps_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -10071,9 +10413,11 @@ cdef class ConfComputeSystemCaps: raise MemoryError("Error allocating ConfComputeSystemCaps") memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeSystemCaps_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -10102,6 +10446,7 @@ cdef class ConfComputeSystemState: cdef: nvmlConfComputeSystemState_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -10109,11 +10454,15 @@ cdef class ConfComputeSystemState: if self._ptr == NULL: raise MemoryError("Error allocating ConfComputeSystemState") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlConfComputeSystemState_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.ConfComputeSystemState object at {hex(id(self))}>" @@ -10143,6 +10492,7 @@ cdef class ConfComputeSystemState: raise MemoryError("Error allocating ConfComputeSystemState") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeSystemState_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -10207,9 +10557,11 @@ cdef class ConfComputeSystemState: raise MemoryError("Error allocating ConfComputeSystemState") memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeSystemState_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -10240,6 +10592,7 @@ cdef class SystemConfComputeSettings_v1: cdef: nvmlSystemConfComputeSettings_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -10247,11 +10600,15 @@ cdef class SystemConfComputeSettings_v1: if self._ptr == NULL: raise MemoryError("Error allocating SystemConfComputeSettings_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlSystemConfComputeSettings_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.SystemConfComputeSettings_v1 object at {hex(id(self))}>" @@ -10281,6 +10638,7 @@ cdef class SystemConfComputeSettings_v1: raise MemoryError("Error allocating SystemConfComputeSettings_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlSystemConfComputeSettings_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -10367,9 +10725,11 @@ cdef class SystemConfComputeSettings_v1: raise MemoryError("Error allocating SystemConfComputeSettings_v1") memcpy((obj._ptr), ptr, sizeof(nvmlSystemConfComputeSettings_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -10397,6 +10757,7 @@ cdef class ConfComputeMemSizeInfo: cdef: nvmlConfComputeMemSizeInfo_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -10404,11 +10765,15 @@ cdef class ConfComputeMemSizeInfo: if self._ptr == NULL: raise MemoryError("Error allocating ConfComputeMemSizeInfo") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlConfComputeMemSizeInfo_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.ConfComputeMemSizeInfo object at {hex(id(self))}>" @@ -10438,6 +10803,7 @@ cdef class ConfComputeMemSizeInfo: raise MemoryError("Error allocating ConfComputeMemSizeInfo") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeMemSizeInfo_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -10491,9 +10857,11 @@ cdef class ConfComputeMemSizeInfo: raise MemoryError("Error allocating ConfComputeMemSizeInfo") memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeMemSizeInfo_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -10523,6 +10891,7 @@ cdef class ConfComputeGpuCertificate: cdef: nvmlConfComputeGpuCertificate_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -10530,11 +10899,15 @@ cdef class ConfComputeGpuCertificate: if self._ptr == NULL: raise MemoryError("Error allocating ConfComputeGpuCertificate") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlConfComputeGpuCertificate_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.ConfComputeGpuCertificate object at {hex(id(self))}>" @@ -10564,6 +10937,7 @@ cdef class ConfComputeGpuCertificate: raise MemoryError("Error allocating ConfComputeGpuCertificate") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeGpuCertificate_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -10647,9 +11021,11 @@ cdef class ConfComputeGpuCertificate: raise MemoryError("Error allocating ConfComputeGpuCertificate") memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeGpuCertificate_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -10681,6 +11057,7 @@ cdef class ConfComputeGpuAttestationReport: cdef: nvmlConfComputeGpuAttestationReport_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -10688,11 +11065,15 @@ cdef class ConfComputeGpuAttestationReport: if self._ptr == NULL: raise MemoryError("Error allocating ConfComputeGpuAttestationReport") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlConfComputeGpuAttestationReport_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.ConfComputeGpuAttestationReport object at {hex(id(self))}>" @@ -10722,6 +11103,7 @@ cdef class ConfComputeGpuAttestationReport: raise MemoryError("Error allocating ConfComputeGpuAttestationReport") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeGpuAttestationReport_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -10831,9 +11213,11 @@ cdef class ConfComputeGpuAttestationReport: raise MemoryError("Error allocating ConfComputeGpuAttestationReport") memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeGpuAttestationReport_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -10861,6 +11245,7 @@ cdef class ConfComputeGetKeyRotationThresholdInfo_v1: cdef: nvmlConfComputeGetKeyRotationThresholdInfo_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -10868,11 +11253,15 @@ cdef class ConfComputeGetKeyRotationThresholdInfo_v1: if self._ptr == NULL: raise MemoryError("Error allocating ConfComputeGetKeyRotationThresholdInfo_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlConfComputeGetKeyRotationThresholdInfo_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.ConfComputeGetKeyRotationThresholdInfo_v1 object at {hex(id(self))}>" @@ -10902,6 +11291,7 @@ cdef class ConfComputeGetKeyRotationThresholdInfo_v1: raise MemoryError("Error allocating ConfComputeGetKeyRotationThresholdInfo_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeGetKeyRotationThresholdInfo_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -10955,9 +11345,11 @@ cdef class ConfComputeGetKeyRotationThresholdInfo_v1: raise MemoryError("Error allocating ConfComputeGetKeyRotationThresholdInfo_v1") memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeGetKeyRotationThresholdInfo_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -10986,6 +11378,7 @@ cdef class NvlinkSupportedBwModes_v1: cdef: nvmlNvlinkSupportedBwModes_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -10993,11 +11386,15 @@ cdef class NvlinkSupportedBwModes_v1: if self._ptr == NULL: raise MemoryError("Error allocating NvlinkSupportedBwModes_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlNvlinkSupportedBwModes_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.NvlinkSupportedBwModes_v1 object at {hex(id(self))}>" @@ -11027,6 +11424,7 @@ cdef class NvlinkSupportedBwModes_v1: raise MemoryError("Error allocating NvlinkSupportedBwModes_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvlinkSupportedBwModes_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -11095,9 +11493,11 @@ cdef class NvlinkSupportedBwModes_v1: raise MemoryError("Error allocating NvlinkSupportedBwModes_v1") memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkSupportedBwModes_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -11126,6 +11526,7 @@ cdef class NvlinkGetBwMode_v1: cdef: nvmlNvlinkGetBwMode_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -11133,11 +11534,15 @@ cdef class NvlinkGetBwMode_v1: if self._ptr == NULL: raise MemoryError("Error allocating NvlinkGetBwMode_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlNvlinkGetBwMode_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.NvlinkGetBwMode_v1 object at {hex(id(self))}>" @@ -11167,6 +11572,7 @@ cdef class NvlinkGetBwMode_v1: raise MemoryError("Error allocating NvlinkGetBwMode_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvlinkGetBwMode_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -11231,9 +11637,11 @@ cdef class NvlinkGetBwMode_v1: raise MemoryError("Error allocating NvlinkGetBwMode_v1") memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkGetBwMode_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -11262,6 +11670,7 @@ cdef class NvlinkSetBwMode_v1: cdef: nvmlNvlinkSetBwMode_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -11269,11 +11678,15 @@ cdef class NvlinkSetBwMode_v1: if self._ptr == NULL: raise MemoryError("Error allocating NvlinkSetBwMode_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlNvlinkSetBwMode_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.NvlinkSetBwMode_v1 object at {hex(id(self))}>" @@ -11303,6 +11716,7 @@ cdef class NvlinkSetBwMode_v1: raise MemoryError("Error allocating NvlinkSetBwMode_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvlinkSetBwMode_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -11367,9 +11781,11 @@ cdef class NvlinkSetBwMode_v1: raise MemoryError("Error allocating NvlinkSetBwMode_v1") memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkSetBwMode_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -11397,6 +11813,7 @@ cdef class VgpuVersion: cdef: nvmlVgpuVersion_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -11404,11 +11821,15 @@ cdef class VgpuVersion: if self._ptr == NULL: raise MemoryError("Error allocating VgpuVersion") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuVersion_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuVersion object at {hex(id(self))}>" @@ -11438,6 +11859,7 @@ cdef class VgpuVersion: raise MemoryError("Error allocating VgpuVersion") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuVersion_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -11491,9 +11913,11 @@ cdef class VgpuVersion: raise MemoryError("Error allocating VgpuVersion") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuVersion_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -11529,6 +11953,7 @@ cdef class VgpuMetadata: cdef: nvmlVgpuMetadata_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -11536,11 +11961,15 @@ cdef class VgpuMetadata: if self._ptr == NULL: raise MemoryError("Error allocating VgpuMetadata") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuMetadata_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuMetadata object at {hex(id(self))}>" @@ -11570,6 +11999,7 @@ cdef class VgpuMetadata: raise MemoryError("Error allocating VgpuMetadata") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuMetadata_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -11712,9 +12142,11 @@ cdef class VgpuMetadata: raise MemoryError("Error allocating VgpuMetadata") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuMetadata_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -11742,6 +12174,7 @@ cdef class VgpuPgpuCompatibility: cdef: nvmlVgpuPgpuCompatibility_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -11749,11 +12182,15 @@ cdef class VgpuPgpuCompatibility: if self._ptr == NULL: raise MemoryError("Error allocating VgpuPgpuCompatibility") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuPgpuCompatibility_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuPgpuCompatibility object at {hex(id(self))}>" @@ -11783,6 +12220,7 @@ cdef class VgpuPgpuCompatibility: raise MemoryError("Error allocating VgpuPgpuCompatibility") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuPgpuCompatibility_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -11836,9 +12274,11 @@ cdef class VgpuPgpuCompatibility: raise MemoryError("Error allocating VgpuPgpuCompatibility") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuPgpuCompatibility_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -12023,6 +12463,7 @@ cdef class GpuInstanceProfileInfo_v2: cdef: nvmlGpuInstanceProfileInfo_v2_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -12030,11 +12471,15 @@ cdef class GpuInstanceProfileInfo_v2: if self._ptr == NULL: raise MemoryError("Error allocating GpuInstanceProfileInfo_v2") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlGpuInstanceProfileInfo_v2_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.GpuInstanceProfileInfo_v2 object at {hex(id(self))}>" @@ -12064,6 +12509,7 @@ cdef class GpuInstanceProfileInfo_v2: raise MemoryError("Error allocating GpuInstanceProfileInfo_v2") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuInstanceProfileInfo_v2_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -12242,9 +12688,11 @@ cdef class GpuInstanceProfileInfo_v2: raise MemoryError("Error allocating GpuInstanceProfileInfo_v2") memcpy((obj._ptr), ptr, sizeof(nvmlGpuInstanceProfileInfo_v2_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -12283,6 +12731,7 @@ cdef class GpuInstanceProfileInfo_v3: cdef: nvmlGpuInstanceProfileInfo_v3_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -12290,11 +12739,15 @@ cdef class GpuInstanceProfileInfo_v3: if self._ptr == NULL: raise MemoryError("Error allocating GpuInstanceProfileInfo_v3") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlGpuInstanceProfileInfo_v3_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.GpuInstanceProfileInfo_v3 object at {hex(id(self))}>" @@ -12324,6 +12777,7 @@ cdef class GpuInstanceProfileInfo_v3: raise MemoryError("Error allocating GpuInstanceProfileInfo_v3") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuInstanceProfileInfo_v3_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -12502,9 +12956,11 @@ cdef class GpuInstanceProfileInfo_v3: raise MemoryError("Error allocating GpuInstanceProfileInfo_v3") memcpy((obj._ptr), ptr, sizeof(nvmlGpuInstanceProfileInfo_v3_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -12687,6 +13143,7 @@ cdef class ComputeInstanceProfileInfo_v2: cdef: nvmlComputeInstanceProfileInfo_v2_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -12694,11 +13151,15 @@ cdef class ComputeInstanceProfileInfo_v2: if self._ptr == NULL: raise MemoryError("Error allocating ComputeInstanceProfileInfo_v2") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlComputeInstanceProfileInfo_v2_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.ComputeInstanceProfileInfo_v2 object at {hex(id(self))}>" @@ -12728,6 +13189,7 @@ cdef class ComputeInstanceProfileInfo_v2: raise MemoryError("Error allocating ComputeInstanceProfileInfo_v2") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlComputeInstanceProfileInfo_v2_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -12884,9 +13346,11 @@ cdef class ComputeInstanceProfileInfo_v2: raise MemoryError("Error allocating ComputeInstanceProfileInfo_v2") memcpy((obj._ptr), ptr, sizeof(nvmlComputeInstanceProfileInfo_v2_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -12924,6 +13388,7 @@ cdef class ComputeInstanceProfileInfo_v3: cdef: nvmlComputeInstanceProfileInfo_v3_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -12931,11 +13396,15 @@ cdef class ComputeInstanceProfileInfo_v3: if self._ptr == NULL: raise MemoryError("Error allocating ComputeInstanceProfileInfo_v3") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlComputeInstanceProfileInfo_v3_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.ComputeInstanceProfileInfo_v3 object at {hex(id(self))}>" @@ -12965,6 +13434,7 @@ cdef class ComputeInstanceProfileInfo_v3: raise MemoryError("Error allocating ComputeInstanceProfileInfo_v3") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlComputeInstanceProfileInfo_v3_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -13132,9 +13602,11 @@ cdef class ComputeInstanceProfileInfo_v3: raise MemoryError("Error allocating ComputeInstanceProfileInfo_v3") memcpy((obj._ptr), ptr, sizeof(nvmlComputeInstanceProfileInfo_v3_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -13162,6 +13634,7 @@ cdef class GpmSupport: cdef: nvmlGpmSupport_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -13169,11 +13642,15 @@ cdef class GpmSupport: if self._ptr == NULL: raise MemoryError("Error allocating GpmSupport") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlGpmSupport_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.GpmSupport object at {hex(id(self))}>" @@ -13203,6 +13680,7 @@ cdef class GpmSupport: raise MemoryError("Error allocating GpmSupport") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpmSupport_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -13256,9 +13734,11 @@ cdef class GpmSupport: raise MemoryError("Error allocating GpmSupport") memcpy((obj._ptr), ptr, sizeof(nvmlGpmSupport_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -13286,6 +13766,7 @@ cdef class DeviceCapabilities_v1: cdef: nvmlDeviceCapabilities_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -13293,11 +13774,15 @@ cdef class DeviceCapabilities_v1: if self._ptr == NULL: raise MemoryError("Error allocating DeviceCapabilities_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlDeviceCapabilities_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.DeviceCapabilities_v1 object at {hex(id(self))}>" @@ -13327,6 +13812,7 @@ cdef class DeviceCapabilities_v1: raise MemoryError("Error allocating DeviceCapabilities_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlDeviceCapabilities_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -13380,9 +13866,11 @@ cdef class DeviceCapabilities_v1: raise MemoryError("Error allocating DeviceCapabilities_v1") memcpy((obj._ptr), ptr, sizeof(nvmlDeviceCapabilities_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -13410,6 +13898,7 @@ cdef class DeviceAddressingMode_v1: cdef: nvmlDeviceAddressingMode_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -13417,11 +13906,15 @@ cdef class DeviceAddressingMode_v1: if self._ptr == NULL: raise MemoryError("Error allocating DeviceAddressingMode_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlDeviceAddressingMode_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.DeviceAddressingMode_v1 object at {hex(id(self))}>" @@ -13451,6 +13944,7 @@ cdef class DeviceAddressingMode_v1: raise MemoryError("Error allocating DeviceAddressingMode_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlDeviceAddressingMode_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -13504,9 +13998,11 @@ cdef class DeviceAddressingMode_v1: raise MemoryError("Error allocating DeviceAddressingMode_v1") memcpy((obj._ptr), ptr, sizeof(nvmlDeviceAddressingMode_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -13535,6 +14031,7 @@ cdef class RepairStatus_v1: cdef: nvmlRepairStatus_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -13542,11 +14039,15 @@ cdef class RepairStatus_v1: if self._ptr == NULL: raise MemoryError("Error allocating RepairStatus_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlRepairStatus_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.RepairStatus_v1 object at {hex(id(self))}>" @@ -13576,6 +14077,7 @@ cdef class RepairStatus_v1: raise MemoryError("Error allocating RepairStatus_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlRepairStatus_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -13640,9 +14142,11 @@ cdef class RepairStatus_v1: raise MemoryError("Error allocating RepairStatus_v1") memcpy((obj._ptr), ptr, sizeof(nvmlRepairStatus_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -13670,6 +14174,7 @@ cdef class Pdi_v1: cdef: nvmlPdi_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -13677,11 +14182,15 @@ cdef class Pdi_v1: if self._ptr == NULL: raise MemoryError("Error allocating Pdi_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlPdi_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.Pdi_v1 object at {hex(id(self))}>" @@ -13711,6 +14220,7 @@ cdef class Pdi_v1: raise MemoryError("Error allocating Pdi_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPdi_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -13764,9 +14274,11 @@ cdef class Pdi_v1: raise MemoryError("Error allocating Pdi_v1") memcpy((obj._ptr), ptr, sizeof(nvmlPdi_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -13795,6 +14307,7 @@ cdef class DevicePowerMizerModes_v1: cdef: nvmlDevicePowerMizerModes_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -13802,11 +14315,15 @@ cdef class DevicePowerMizerModes_v1: if self._ptr == NULL: raise MemoryError("Error allocating DevicePowerMizerModes_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlDevicePowerMizerModes_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.DevicePowerMizerModes_v1 object at {hex(id(self))}>" @@ -13836,6 +14353,7 @@ cdef class DevicePowerMizerModes_v1: raise MemoryError("Error allocating DevicePowerMizerModes_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlDevicePowerMizerModes_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -13900,9 +14418,11 @@ cdef class DevicePowerMizerModes_v1: raise MemoryError("Error allocating DevicePowerMizerModes_v1") memcpy((obj._ptr), ptr, sizeof(nvmlDevicePowerMizerModes_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -14141,6 +14661,7 @@ cdef class GpuFabricInfo_v3: cdef: nvmlGpuFabricInfo_v3_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -14148,11 +14669,15 @@ cdef class GpuFabricInfo_v3: if self._ptr == NULL: raise MemoryError("Error allocating GpuFabricInfo_v3") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlGpuFabricInfo_v3_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.GpuFabricInfo_v3 object at {hex(id(self))}>" @@ -14182,6 +14707,7 @@ cdef class GpuFabricInfo_v3: raise MemoryError("Error allocating GpuFabricInfo_v3") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuFabricInfo_v3_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -14294,9 +14820,11 @@ cdef class GpuFabricInfo_v3: raise MemoryError("Error allocating GpuFabricInfo_v3") memcpy((obj._ptr), ptr, sizeof(nvmlGpuFabricInfo_v3_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -14326,6 +14854,7 @@ cdef class NvlinkFirmwareVersion: cdef: nvmlNvlinkFirmwareVersion_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -14333,11 +14862,15 @@ cdef class NvlinkFirmwareVersion: if self._ptr == NULL: raise MemoryError("Error allocating NvlinkFirmwareVersion") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlNvlinkFirmwareVersion_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.NvlinkFirmwareVersion object at {hex(id(self))}>" @@ -14367,6 +14900,7 @@ cdef class NvlinkFirmwareVersion: raise MemoryError("Error allocating NvlinkFirmwareVersion") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvlinkFirmwareVersion_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -14442,9 +14976,11 @@ cdef class NvlinkFirmwareVersion: raise MemoryError("Error allocating NvlinkFirmwareVersion") memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkFirmwareVersion_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -14472,6 +15008,7 @@ cdef class ExcludedDeviceInfo: cdef: nvmlExcludedDeviceInfo_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -14479,11 +15016,15 @@ cdef class ExcludedDeviceInfo: if self._ptr == NULL: raise MemoryError("Error allocating ExcludedDeviceInfo") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlExcludedDeviceInfo_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.ExcludedDeviceInfo object at {hex(id(self))}>" @@ -14513,6 +15054,7 @@ cdef class ExcludedDeviceInfo: raise MemoryError("Error allocating ExcludedDeviceInfo") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlExcludedDeviceInfo_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -14571,9 +15113,11 @@ cdef class ExcludedDeviceInfo: raise MemoryError("Error allocating ExcludedDeviceInfo") memcpy((obj._ptr), ptr, sizeof(nvmlExcludedDeviceInfo_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -14603,6 +15147,7 @@ cdef class ProcessDetailList_v1: cdef: nvmlProcessDetailList_v1_t *_ptr object _owner + bint _owned bint _readonly dict _refs @@ -14611,12 +15156,16 @@ cdef class ProcessDetailList_v1: if self._ptr == NULL: raise MemoryError("Error allocating ProcessDetailList_v1") self._owner = None + self._owned = True self._readonly = False self._refs = {} def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlProcessDetailList_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.ProcessDetailList_v1 object at {hex(id(self))}>" @@ -14646,6 +15195,7 @@ cdef class ProcessDetailList_v1: raise MemoryError("Error allocating ProcessDetailList_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlProcessDetailList_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -14715,9 +15265,11 @@ cdef class ProcessDetailList_v1: raise MemoryError("Error allocating ProcessDetailList_v1") memcpy((obj._ptr), ptr, sizeof(nvmlProcessDetailList_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -14746,6 +15298,7 @@ cdef class BridgeChipHierarchy: cdef: nvmlBridgeChipHierarchy_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -14753,11 +15306,15 @@ cdef class BridgeChipHierarchy: if self._ptr == NULL: raise MemoryError("Error allocating BridgeChipHierarchy") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlBridgeChipHierarchy_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.BridgeChipHierarchy object at {hex(id(self))}>" @@ -14787,6 +15344,7 @@ cdef class BridgeChipHierarchy: raise MemoryError("Error allocating BridgeChipHierarchy") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlBridgeChipHierarchy_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -14843,9 +15401,11 @@ cdef class BridgeChipHierarchy: raise MemoryError("Error allocating BridgeChipHierarchy") memcpy((obj._ptr), ptr, sizeof(nvmlBridgeChipHierarchy_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -15539,6 +16099,7 @@ cdef class GpuThermalSettings: cdef: nvmlGpuThermalSettings_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -15546,11 +16107,15 @@ cdef class GpuThermalSettings: if self._ptr == NULL: raise MemoryError("Error allocating GpuThermalSettings") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlGpuThermalSettings_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.GpuThermalSettings object at {hex(id(self))}>" @@ -15580,6 +16145,7 @@ cdef class GpuThermalSettings: raise MemoryError("Error allocating GpuThermalSettings") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuThermalSettings_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -15636,9 +16202,11 @@ cdef class GpuThermalSettings: raise MemoryError("Error allocating GpuThermalSettings") memcpy((obj._ptr), ptr, sizeof(nvmlGpuThermalSettings_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -15667,6 +16235,7 @@ cdef class ClkMonStatus: cdef: nvmlClkMonStatus_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -15674,11 +16243,15 @@ cdef class ClkMonStatus: if self._ptr == NULL: raise MemoryError("Error allocating ClkMonStatus") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlClkMonStatus_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.ClkMonStatus object at {hex(id(self))}>" @@ -15708,6 +16281,7 @@ cdef class ClkMonStatus: raise MemoryError("Error allocating ClkMonStatus") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlClkMonStatus_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -15775,9 +16349,11 @@ cdef class ClkMonStatus: raise MemoryError("Error allocating ClkMonStatus") memcpy((obj._ptr), ptr, sizeof(nvmlClkMonStatus_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -15807,6 +16383,7 @@ cdef class ProcessesUtilizationInfo_v1: cdef: nvmlProcessesUtilizationInfo_v1_t *_ptr object _owner + bint _owned bint _readonly dict _refs @@ -15815,12 +16392,16 @@ cdef class ProcessesUtilizationInfo_v1: if self._ptr == NULL: raise MemoryError("Error allocating ProcessesUtilizationInfo_v1") self._owner = None + self._owned = True self._readonly = False self._refs = {} def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlProcessesUtilizationInfo_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.ProcessesUtilizationInfo_v1 object at {hex(id(self))}>" @@ -15850,6 +16431,7 @@ cdef class ProcessesUtilizationInfo_v1: raise MemoryError("Error allocating ProcessesUtilizationInfo_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlProcessesUtilizationInfo_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -15919,9 +16501,11 @@ cdef class ProcessesUtilizationInfo_v1: raise MemoryError("Error allocating ProcessesUtilizationInfo_v1") memcpy((obj._ptr), ptr, sizeof(nvmlProcessesUtilizationInfo_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -15950,6 +16534,7 @@ cdef class GpuDynamicPstatesInfo: cdef: nvmlGpuDynamicPstatesInfo_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -15957,11 +16542,15 @@ cdef class GpuDynamicPstatesInfo: if self._ptr == NULL: raise MemoryError("Error allocating GpuDynamicPstatesInfo") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlGpuDynamicPstatesInfo_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.GpuDynamicPstatesInfo object at {hex(id(self))}>" @@ -15991,6 +16580,7 @@ cdef class GpuDynamicPstatesInfo: raise MemoryError("Error allocating GpuDynamicPstatesInfo") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuDynamicPstatesInfo_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -16047,9 +16637,11 @@ cdef class GpuDynamicPstatesInfo: raise MemoryError("Error allocating GpuDynamicPstatesInfo") memcpy((obj._ptr), ptr, sizeof(nvmlGpuDynamicPstatesInfo_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -16079,6 +16671,7 @@ cdef class VgpuProcessesUtilizationInfo_v1: cdef: nvmlVgpuProcessesUtilizationInfo_v1_t *_ptr object _owner + bint _owned bint _readonly dict _refs @@ -16087,12 +16680,16 @@ cdef class VgpuProcessesUtilizationInfo_v1: if self._ptr == NULL: raise MemoryError("Error allocating VgpuProcessesUtilizationInfo_v1") self._owner = None + self._owned = True self._readonly = False self._refs = {} def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuProcessesUtilizationInfo_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuProcessesUtilizationInfo_v1 object at {hex(id(self))}>" @@ -16122,6 +16719,7 @@ cdef class VgpuProcessesUtilizationInfo_v1: raise MemoryError("Error allocating VgpuProcessesUtilizationInfo_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -16191,9 +16789,11 @@ cdef class VgpuProcessesUtilizationInfo_v1: raise MemoryError("Error allocating VgpuProcessesUtilizationInfo_v1") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -16217,6 +16817,7 @@ cdef class VgpuSchedulerParams: cdef: nvmlVgpuSchedulerParams_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -16224,11 +16825,15 @@ cdef class VgpuSchedulerParams: if self._ptr == NULL: raise MemoryError("Error allocating VgpuSchedulerParams") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuSchedulerParams_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuSchedulerParams object at {hex(id(self))}>" @@ -16258,6 +16863,7 @@ cdef class VgpuSchedulerParams: raise MemoryError("Error allocating VgpuSchedulerParams") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerParams_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -16313,9 +16919,11 @@ cdef class VgpuSchedulerParams: raise MemoryError("Error allocating VgpuSchedulerParams") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerParams_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -16338,6 +16946,7 @@ cdef class VgpuSchedulerSetParams: cdef: nvmlVgpuSchedulerSetParams_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -16345,11 +16954,15 @@ cdef class VgpuSchedulerSetParams: if self._ptr == NULL: raise MemoryError("Error allocating VgpuSchedulerSetParams") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuSchedulerSetParams_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuSchedulerSetParams object at {hex(id(self))}>" @@ -16379,6 +16992,7 @@ cdef class VgpuSchedulerSetParams: raise MemoryError("Error allocating VgpuSchedulerSetParams") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerSetParams_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -16434,9 +17048,11 @@ cdef class VgpuSchedulerSetParams: raise MemoryError("Error allocating VgpuSchedulerSetParams") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerSetParams_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -16465,6 +17081,7 @@ cdef class VgpuLicenseInfo: cdef: nvmlVgpuLicenseInfo_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -16472,11 +17089,15 @@ cdef class VgpuLicenseInfo: if self._ptr == NULL: raise MemoryError("Error allocating VgpuLicenseInfo") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuLicenseInfo_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuLicenseInfo object at {hex(id(self))}>" @@ -16506,6 +17127,7 @@ cdef class VgpuLicenseInfo: raise MemoryError("Error allocating VgpuLicenseInfo") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuLicenseInfo_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -16571,9 +17193,11 @@ cdef class VgpuLicenseInfo: raise MemoryError("Error allocating VgpuLicenseInfo") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuLicenseInfo_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -16803,6 +17427,7 @@ cdef class UnitFanSpeeds: cdef: nvmlUnitFanSpeeds_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -16810,11 +17435,15 @@ cdef class UnitFanSpeeds: if self._ptr == NULL: raise MemoryError("Error allocating UnitFanSpeeds") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlUnitFanSpeeds_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.UnitFanSpeeds object at {hex(id(self))}>" @@ -16844,6 +17473,7 @@ cdef class UnitFanSpeeds: raise MemoryError("Error allocating UnitFanSpeeds") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlUnitFanSpeeds_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -16900,9 +17530,11 @@ cdef class UnitFanSpeeds: raise MemoryError("Error allocating UnitFanSpeeds") memcpy((obj._ptr), ptr, sizeof(nvmlUnitFanSpeeds_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -16936,6 +17568,7 @@ cdef class VgpuPgpuMetadata: cdef: nvmlVgpuPgpuMetadata_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -16943,11 +17576,15 @@ cdef class VgpuPgpuMetadata: if self._ptr == NULL: raise MemoryError("Error allocating VgpuPgpuMetadata") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuPgpuMetadata_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuPgpuMetadata object at {hex(id(self))}>" @@ -16977,6 +17614,7 @@ cdef class VgpuPgpuMetadata: raise MemoryError("Error allocating VgpuPgpuMetadata") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuPgpuMetadata_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -17094,9 +17732,11 @@ cdef class VgpuPgpuMetadata: raise MemoryError("Error allocating VgpuPgpuMetadata") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuPgpuMetadata_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -17126,6 +17766,7 @@ cdef class GpuInstanceInfo: cdef: nvmlGpuInstanceInfo_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -17133,11 +17774,15 @@ cdef class GpuInstanceInfo: if self._ptr == NULL: raise MemoryError("Error allocating GpuInstanceInfo") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlGpuInstanceInfo_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.GpuInstanceInfo object at {hex(id(self))}>" @@ -17167,6 +17812,7 @@ cdef class GpuInstanceInfo: raise MemoryError("Error allocating GpuInstanceInfo") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuInstanceInfo_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -17243,9 +17889,11 @@ cdef class GpuInstanceInfo: raise MemoryError("Error allocating GpuInstanceInfo") memcpy((obj._ptr), ptr, sizeof(nvmlGpuInstanceInfo_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -17276,6 +17924,7 @@ cdef class ComputeInstanceInfo: cdef: nvmlComputeInstanceInfo_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -17283,11 +17932,15 @@ cdef class ComputeInstanceInfo: if self._ptr == NULL: raise MemoryError("Error allocating ComputeInstanceInfo") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlComputeInstanceInfo_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.ComputeInstanceInfo object at {hex(id(self))}>" @@ -17317,6 +17970,7 @@ cdef class ComputeInstanceInfo: raise MemoryError("Error allocating ComputeInstanceInfo") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlComputeInstanceInfo_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -17404,9 +18058,11 @@ cdef class ComputeInstanceInfo: raise MemoryError("Error allocating ComputeInstanceInfo") memcpy((obj._ptr), ptr, sizeof(nvmlComputeInstanceInfo_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -17435,6 +18091,7 @@ cdef class EccSramUniqueUncorrectedErrorCounts_v1: cdef: nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *_ptr object _owner + bint _owned bint _readonly dict _refs @@ -17443,12 +18100,16 @@ cdef class EccSramUniqueUncorrectedErrorCounts_v1: if self._ptr == NULL: raise MemoryError("Error allocating EccSramUniqueUncorrectedErrorCounts_v1") self._owner = None + self._owned = True self._readonly = False self._refs = {} def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.EccSramUniqueUncorrectedErrorCounts_v1 object at {hex(id(self))}>" @@ -17478,6 +18139,7 @@ cdef class EccSramUniqueUncorrectedErrorCounts_v1: raise MemoryError("Error allocating EccSramUniqueUncorrectedErrorCounts_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -17536,9 +18198,11 @@ cdef class EccSramUniqueUncorrectedErrorCounts_v1: raise MemoryError("Error allocating EccSramUniqueUncorrectedErrorCounts_v1") memcpy((obj._ptr), ptr, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -17567,6 +18231,7 @@ cdef class NvlinkFirmwareInfo: cdef: nvmlNvlinkFirmwareInfo_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -17574,11 +18239,15 @@ cdef class NvlinkFirmwareInfo: if self._ptr == NULL: raise MemoryError("Error allocating NvlinkFirmwareInfo") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlNvlinkFirmwareInfo_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.NvlinkFirmwareInfo object at {hex(id(self))}>" @@ -17608,6 +18277,7 @@ cdef class NvlinkFirmwareInfo: raise MemoryError("Error allocating NvlinkFirmwareInfo") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvlinkFirmwareInfo_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -17664,9 +18334,11 @@ cdef class NvlinkFirmwareInfo: raise MemoryError("Error allocating NvlinkFirmwareInfo") memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkFirmwareInfo_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -17697,6 +18369,7 @@ cdef class VgpuInstancesUtilizationInfo_v1: cdef: nvmlVgpuInstancesUtilizationInfo_v1_t *_ptr object _owner + bint _owned bint _readonly dict _refs @@ -17705,12 +18378,16 @@ cdef class VgpuInstancesUtilizationInfo_v1: if self._ptr == NULL: raise MemoryError("Error allocating VgpuInstancesUtilizationInfo_v1") self._owner = None + self._owned = True self._readonly = False self._refs = {} def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuInstancesUtilizationInfo_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuInstancesUtilizationInfo_v1 object at {hex(id(self))}>" @@ -17740,6 +18417,7 @@ cdef class VgpuInstancesUtilizationInfo_v1: raise MemoryError("Error allocating VgpuInstancesUtilizationInfo_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -17820,9 +18498,11 @@ cdef class VgpuInstancesUtilizationInfo_v1: raise MemoryError("Error allocating VgpuInstancesUtilizationInfo_v1") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -17855,6 +18535,7 @@ cdef class VgpuSchedulerLog: cdef: nvmlVgpuSchedulerLog_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -17862,11 +18543,15 @@ cdef class VgpuSchedulerLog: if self._ptr == NULL: raise MemoryError("Error allocating VgpuSchedulerLog") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuSchedulerLog_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuSchedulerLog object at {hex(id(self))}>" @@ -17896,6 +18581,7 @@ cdef class VgpuSchedulerLog: raise MemoryError("Error allocating VgpuSchedulerLog") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerLog_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -17997,9 +18683,11 @@ cdef class VgpuSchedulerLog: raise MemoryError("Error allocating VgpuSchedulerLog") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerLog_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -18028,6 +18716,7 @@ cdef class VgpuSchedulerGetState: cdef: nvmlVgpuSchedulerGetState_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -18035,11 +18724,15 @@ cdef class VgpuSchedulerGetState: if self._ptr == NULL: raise MemoryError("Error allocating VgpuSchedulerGetState") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuSchedulerGetState_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuSchedulerGetState object at {hex(id(self))}>" @@ -18069,6 +18762,7 @@ cdef class VgpuSchedulerGetState: raise MemoryError("Error allocating VgpuSchedulerGetState") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerGetState_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -18134,9 +18828,11 @@ cdef class VgpuSchedulerGetState: raise MemoryError("Error allocating VgpuSchedulerGetState") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerGetState_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -18167,6 +18863,7 @@ cdef class VgpuSchedulerStateInfo_v1: cdef: nvmlVgpuSchedulerStateInfo_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -18174,11 +18871,15 @@ cdef class VgpuSchedulerStateInfo_v1: if self._ptr == NULL: raise MemoryError("Error allocating VgpuSchedulerStateInfo_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuSchedulerStateInfo_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuSchedulerStateInfo_v1 object at {hex(id(self))}>" @@ -18208,6 +18909,7 @@ cdef class VgpuSchedulerStateInfo_v1: raise MemoryError("Error allocating VgpuSchedulerStateInfo_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -18295,9 +18997,11 @@ cdef class VgpuSchedulerStateInfo_v1: raise MemoryError("Error allocating VgpuSchedulerStateInfo_v1") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -18330,6 +19034,7 @@ cdef class VgpuSchedulerLogInfo_v1: cdef: nvmlVgpuSchedulerLogInfo_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -18337,11 +19042,15 @@ cdef class VgpuSchedulerLogInfo_v1: if self._ptr == NULL: raise MemoryError("Error allocating VgpuSchedulerLogInfo_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuSchedulerLogInfo_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuSchedulerLogInfo_v1 object at {hex(id(self))}>" @@ -18371,6 +19080,7 @@ cdef class VgpuSchedulerLogInfo_v1: raise MemoryError("Error allocating VgpuSchedulerLogInfo_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -18483,9 +19193,11 @@ cdef class VgpuSchedulerLogInfo_v1: raise MemoryError("Error allocating VgpuSchedulerLogInfo_v1") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -18516,6 +19228,7 @@ cdef class VgpuSchedulerState_v1: cdef: nvmlVgpuSchedulerState_v1_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -18523,11 +19236,15 @@ cdef class VgpuSchedulerState_v1: if self._ptr == NULL: raise MemoryError("Error allocating VgpuSchedulerState_v1") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlVgpuSchedulerState_v1_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.VgpuSchedulerState_v1 object at {hex(id(self))}>" @@ -18557,6 +19274,7 @@ cdef class VgpuSchedulerState_v1: raise MemoryError("Error allocating VgpuSchedulerState_v1") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerState_v1_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -18644,9 +19362,11 @@ cdef class VgpuSchedulerState_v1: raise MemoryError("Error allocating VgpuSchedulerState_v1") memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerState_v1_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -18675,6 +19395,7 @@ cdef class GridLicensableFeatures: cdef: nvmlGridLicensableFeatures_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -18682,11 +19403,15 @@ cdef class GridLicensableFeatures: if self._ptr == NULL: raise MemoryError("Error allocating GridLicensableFeatures") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlGridLicensableFeatures_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.GridLicensableFeatures object at {hex(id(self))}>" @@ -18716,6 +19441,7 @@ cdef class GridLicensableFeatures: raise MemoryError("Error allocating GridLicensableFeatures") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGridLicensableFeatures_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -18783,9 +19509,11 @@ cdef class GridLicensableFeatures: raise MemoryError("Error allocating GridLicensableFeatures") memcpy((obj._ptr), ptr, sizeof(nvmlGridLicensableFeatures_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -18814,6 +19542,7 @@ cdef class NvLinkInfo_v2: cdef: nvmlNvLinkInfo_v2_t *_ptr object _owner + bint _owned bint _readonly def __init__(self): @@ -18821,11 +19550,15 @@ cdef class NvLinkInfo_v2: if self._ptr == NULL: raise MemoryError("Error allocating NvLinkInfo_v2") self._owner = None + self._owned = True self._readonly = False def __dealloc__(self): - if self._owner is None: - free(self._ptr) + cdef nvmlNvLinkInfo_v2_t *ptr + if self._owner is None and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + free(ptr) def __repr__(self): return f"<{__name__}.NvLinkInfo_v2 object at {hex(id(self))}>" @@ -18855,6 +19588,7 @@ cdef class NvLinkInfo_v2: raise MemoryError("Error allocating NvLinkInfo_v2") memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvLinkInfo_v2_t)) self._owner = None + self._owned = True self._readonly = not val.flags.writeable else: setattr(self, key, val) @@ -18920,9 +19654,11 @@ cdef class NvLinkInfo_v2: raise MemoryError("Error allocating NvLinkInfo_v2") memcpy((obj._ptr), ptr, sizeof(nvmlNvLinkInfo_v2_t)) obj._owner = None + obj._owned = True else: obj._ptr = ptr obj._owner = owner + obj._owned = False obj._readonly = readonly return obj @@ -24943,7 +25679,7 @@ cpdef object device_get_field_values(intptr_t device, values): __status__ = nvmlDeviceGetFieldValues(device, valuesCount, ptr) check_status(__status__) - return values_ + return FieldValue.from_ptr(ptr, valuesCount) cpdef object device_clear_field_values(intptr_t device, values): From ad4ffc20f799cfe616fed3a5372b9b7022f73851 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Mon, 1 Dec 2025 16:02:00 -0500 Subject: [PATCH 8/9] Fix compilation --- cuda_bindings/cuda/bindings/nvml.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cuda_bindings/cuda/bindings/nvml.pyx b/cuda_bindings/cuda/bindings/nvml.pyx index b83dcb8813..2984f731a4 100644 --- a/cuda_bindings/cuda/bindings/nvml.pyx +++ b/cuda_bindings/cuda/bindings/nvml.pyx @@ -25679,7 +25679,7 @@ cpdef object device_get_field_values(intptr_t device, values): __status__ = nvmlDeviceGetFieldValues(device, valuesCount, ptr) check_status(__status__) - return FieldValue.from_ptr(ptr, valuesCount) + return FieldValue.from_ptr(ptr, valuesCount) cpdef object device_clear_field_values(intptr_t device, values): From f932f0d8c0c8154a2b9023ca8bad4126d9becc2d Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Mon, 1 Dec 2025 16:25:12 -0500 Subject: [PATCH 9/9] Fix free-threading --- cuda_bindings/cuda/bindings/cufile.pyx | 16 +-- cuda_bindings/cuda/bindings/nvml.pyx | 184 ++++++++++++------------- 2 files changed, 100 insertions(+), 100 deletions(-) diff --git a/cuda_bindings/cuda/bindings/cufile.pyx b/cuda_bindings/cuda/bindings/cufile.pyx index 02f204b1f3..1f997dff66 100644 --- a/cuda_bindings/cuda/bindings/cufile.pyx +++ b/cuda_bindings/cuda/bindings/cufile.pyx @@ -68,7 +68,7 @@ cdef class _py_anon_pod1: def __dealloc__(self): cdef _anon_pod1 *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -202,7 +202,7 @@ cdef class _py_anon_pod3: def __dealloc__(self): cdef _anon_pod3 *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -514,7 +514,7 @@ cdef class OpCounter: def __dealloc__(self): cdef CUfileOpCounter_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -674,7 +674,7 @@ cdef class PerGpuStats: def __dealloc__(self): cdef CUfilePerGpuStats_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -1282,7 +1282,7 @@ cdef class _py_anon_pod2: def __dealloc__(self): cdef _anon_pod2 *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -1445,7 +1445,7 @@ cdef class StatsLevel1: def __dealloc__(self): cdef CUfileStatsLevel1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -2244,7 +2244,7 @@ cdef class StatsLevel2: def __dealloc__(self): cdef CUfileStatsLevel2_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -2397,7 +2397,7 @@ cdef class StatsLevel3: def __dealloc__(self): cdef CUfileStatsLevel3_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) diff --git a/cuda_bindings/cuda/bindings/nvml.pyx b/cuda_bindings/cuda/bindings/nvml.pyx index 2984f731a4..db1b81ae48 100644 --- a/cuda_bindings/cuda/bindings/nvml.pyx +++ b/cuda_bindings/cuda/bindings/nvml.pyx @@ -1366,7 +1366,7 @@ cdef class PciInfoExt_v1: def __dealloc__(self): cdef nvmlPciInfoExt_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -1584,7 +1584,7 @@ cdef class PciInfo: def __dealloc__(self): cdef nvmlPciInfo_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -1779,7 +1779,7 @@ cdef class Utilization: def __dealloc__(self): cdef nvmlUtilization_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -1912,7 +1912,7 @@ cdef class Memory: def __dealloc__(self): cdef nvmlMemory_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -2058,7 +2058,7 @@ cdef class Memory_v2: def __dealloc__(self): cdef nvmlMemory_v2_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -2213,7 +2213,7 @@ cdef class BAR1Memory: def __dealloc__(self): cdef nvmlBAR1Memory_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -2715,7 +2715,7 @@ cdef class DeviceAttributes: def __dealloc__(self): cdef nvmlDeviceAttributes_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -2923,7 +2923,7 @@ cdef class C2cModeInfo_v1: def __dealloc__(self): cdef nvmlC2cModeInfo_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -3047,7 +3047,7 @@ cdef class RowRemapperHistogramValues: def __dealloc__(self): cdef nvmlRowRemapperHistogramValues_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -3358,7 +3358,7 @@ cdef class Value: def __dealloc__(self): cdef nvmlValue_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -3548,7 +3548,7 @@ cdef class _py_anon_pod0: def __dealloc__(self): cdef _anon_pod0 *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -3715,7 +3715,7 @@ cdef class CoolerInfo_v1: def __dealloc__(self): cdef nvmlCoolerInfo_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -3869,7 +3869,7 @@ cdef class MarginTemperature_v1: def __dealloc__(self): cdef nvmlMarginTemperature_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -4151,7 +4151,7 @@ cdef class ClockOffset_v1: def __dealloc__(self): cdef nvmlClockOffset_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -4328,7 +4328,7 @@ cdef class FanSpeedInfo_v1: def __dealloc__(self): cdef nvmlFanSpeedInfo_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -4471,7 +4471,7 @@ cdef class DevicePerfModes_v1: def __dealloc__(self): cdef nvmlDevicePerfModes_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -4607,7 +4607,7 @@ cdef class DeviceCurrentClockFreqs_v1: def __dealloc__(self): cdef nvmlDeviceCurrentClockFreqs_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -5166,7 +5166,7 @@ cdef class EccSramErrorStatus_v1: def __dealloc__(self): cdef nvmlEccSramErrorStatus_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -5425,7 +5425,7 @@ cdef class PlatformInfo_v2: def __dealloc__(self): cdef nvmlPlatformInfo_v2_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -5633,7 +5633,7 @@ cdef class _py_anon_pod1: def __dealloc__(self): cdef _anon_pod1 *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -5787,7 +5787,7 @@ cdef class VgpuHeterogeneousMode_v1: def __dealloc__(self): cdef nvmlVgpuHeterogeneousMode_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -5919,7 +5919,7 @@ cdef class VgpuPlacementId_v1: def __dealloc__(self): cdef nvmlVgpuPlacementId_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -6056,7 +6056,7 @@ cdef class VgpuPlacementList_v2: def __dealloc__(self): cdef nvmlVgpuPlacementList_v2_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -6219,7 +6219,7 @@ cdef class VgpuTypeBar1Info_v1: def __dealloc__(self): cdef nvmlVgpuTypeBar1Info_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -6591,7 +6591,7 @@ cdef class VgpuRuntimeState_v1: def __dealloc__(self): cdef nvmlVgpuRuntimeState_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -6723,7 +6723,7 @@ cdef class _py_anon_pod2: def __dealloc__(self): cdef _anon_pod2 *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -6854,7 +6854,7 @@ cdef class _py_anon_pod3: def __dealloc__(self): cdef _anon_pod3 *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -7169,7 +7169,7 @@ cdef class _py_anon_pod4: def __dealloc__(self): cdef _anon_pod4 *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -7300,7 +7300,7 @@ cdef class _py_anon_pod5: def __dealloc__(self): cdef _anon_pod5 *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -7427,7 +7427,7 @@ cdef class VgpuSchedulerCapabilities: def __dealloc__(self): cdef nvmlVgpuSchedulerCapabilities_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -7634,7 +7634,7 @@ cdef class VgpuLicenseExpiry: def __dealloc__(self): cdef nvmlVgpuLicenseExpiry_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -7826,7 +7826,7 @@ cdef class GridLicenseExpiry: def __dealloc__(self): cdef nvmlGridLicenseExpiry_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -8014,7 +8014,7 @@ cdef class VgpuTypeIdInfo_v1: def __dealloc__(self): cdef nvmlVgpuTypeIdInfo_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -8147,7 +8147,7 @@ cdef class VgpuTypeMaxInstance_v1: def __dealloc__(self): cdef nvmlVgpuTypeMaxInstance_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -8291,7 +8291,7 @@ cdef class ActiveVgpuInstanceInfo_v1: def __dealloc__(self): cdef nvmlActiveVgpuInstanceInfo_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -8428,7 +8428,7 @@ cdef class VgpuCreatablePlacementInfo_v1: def __dealloc__(self): cdef nvmlVgpuCreatablePlacementInfo_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -8735,7 +8735,7 @@ cdef class LedState: def __dealloc__(self): cdef nvmlLedState_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -8873,7 +8873,7 @@ cdef class UnitInfo: def __dealloc__(self): cdef nvmlUnitInfo_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -9045,7 +9045,7 @@ cdef class PSUInfo: def __dealloc__(self): cdef nvmlPSUInfo_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -9352,7 +9352,7 @@ cdef class EventData: def __dealloc__(self): cdef nvmlEventData_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -9522,7 +9522,7 @@ cdef class AccountingStats: def __dealloc__(self): cdef nvmlAccountingStats_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -9917,7 +9917,7 @@ cdef class FBCStats: def __dealloc__(self): cdef nvmlFBCStats_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -10326,7 +10326,7 @@ cdef class ConfComputeSystemCaps: def __dealloc__(self): cdef nvmlConfComputeSystemCaps_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -10459,7 +10459,7 @@ cdef class ConfComputeSystemState: def __dealloc__(self): cdef nvmlConfComputeSystemState_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -10605,7 +10605,7 @@ cdef class SystemConfComputeSettings_v1: def __dealloc__(self): cdef nvmlSystemConfComputeSettings_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -10770,7 +10770,7 @@ cdef class ConfComputeMemSizeInfo: def __dealloc__(self): cdef nvmlConfComputeMemSizeInfo_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -10904,7 +10904,7 @@ cdef class ConfComputeGpuCertificate: def __dealloc__(self): cdef nvmlConfComputeGpuCertificate_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -11070,7 +11070,7 @@ cdef class ConfComputeGpuAttestationReport: def __dealloc__(self): cdef nvmlConfComputeGpuAttestationReport_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -11258,7 +11258,7 @@ cdef class ConfComputeGetKeyRotationThresholdInfo_v1: def __dealloc__(self): cdef nvmlConfComputeGetKeyRotationThresholdInfo_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -11391,7 +11391,7 @@ cdef class NvlinkSupportedBwModes_v1: def __dealloc__(self): cdef nvmlNvlinkSupportedBwModes_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -11539,7 +11539,7 @@ cdef class NvlinkGetBwMode_v1: def __dealloc__(self): cdef nvmlNvlinkGetBwMode_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -11683,7 +11683,7 @@ cdef class NvlinkSetBwMode_v1: def __dealloc__(self): cdef nvmlNvlinkSetBwMode_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -11826,7 +11826,7 @@ cdef class VgpuVersion: def __dealloc__(self): cdef nvmlVgpuVersion_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -11966,7 +11966,7 @@ cdef class VgpuMetadata: def __dealloc__(self): cdef nvmlVgpuMetadata_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -12187,7 +12187,7 @@ cdef class VgpuPgpuCompatibility: def __dealloc__(self): cdef nvmlVgpuPgpuCompatibility_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -12476,7 +12476,7 @@ cdef class GpuInstanceProfileInfo_v2: def __dealloc__(self): cdef nvmlGpuInstanceProfileInfo_v2_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -12744,7 +12744,7 @@ cdef class GpuInstanceProfileInfo_v3: def __dealloc__(self): cdef nvmlGpuInstanceProfileInfo_v3_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -13156,7 +13156,7 @@ cdef class ComputeInstanceProfileInfo_v2: def __dealloc__(self): cdef nvmlComputeInstanceProfileInfo_v2_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -13401,7 +13401,7 @@ cdef class ComputeInstanceProfileInfo_v3: def __dealloc__(self): cdef nvmlComputeInstanceProfileInfo_v3_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -13647,7 +13647,7 @@ cdef class GpmSupport: def __dealloc__(self): cdef nvmlGpmSupport_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -13779,7 +13779,7 @@ cdef class DeviceCapabilities_v1: def __dealloc__(self): cdef nvmlDeviceCapabilities_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -13911,7 +13911,7 @@ cdef class DeviceAddressingMode_v1: def __dealloc__(self): cdef nvmlDeviceAddressingMode_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -14044,7 +14044,7 @@ cdef class RepairStatus_v1: def __dealloc__(self): cdef nvmlRepairStatus_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -14187,7 +14187,7 @@ cdef class Pdi_v1: def __dealloc__(self): cdef nvmlPdi_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -14320,7 +14320,7 @@ cdef class DevicePowerMizerModes_v1: def __dealloc__(self): cdef nvmlDevicePowerMizerModes_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -14674,7 +14674,7 @@ cdef class GpuFabricInfo_v3: def __dealloc__(self): cdef nvmlGpuFabricInfo_v3_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -14867,7 +14867,7 @@ cdef class NvlinkFirmwareVersion: def __dealloc__(self): cdef nvmlNvlinkFirmwareVersion_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -15021,7 +15021,7 @@ cdef class ExcludedDeviceInfo: def __dealloc__(self): cdef nvmlExcludedDeviceInfo_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -15162,7 +15162,7 @@ cdef class ProcessDetailList_v1: def __dealloc__(self): cdef nvmlProcessDetailList_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -15311,7 +15311,7 @@ cdef class BridgeChipHierarchy: def __dealloc__(self): cdef nvmlBridgeChipHierarchy_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -16112,7 +16112,7 @@ cdef class GpuThermalSettings: def __dealloc__(self): cdef nvmlGpuThermalSettings_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -16248,7 +16248,7 @@ cdef class ClkMonStatus: def __dealloc__(self): cdef nvmlClkMonStatus_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -16398,7 +16398,7 @@ cdef class ProcessesUtilizationInfo_v1: def __dealloc__(self): cdef nvmlProcessesUtilizationInfo_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -16547,7 +16547,7 @@ cdef class GpuDynamicPstatesInfo: def __dealloc__(self): cdef nvmlGpuDynamicPstatesInfo_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -16686,7 +16686,7 @@ cdef class VgpuProcessesUtilizationInfo_v1: def __dealloc__(self): cdef nvmlVgpuProcessesUtilizationInfo_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -16830,7 +16830,7 @@ cdef class VgpuSchedulerParams: def __dealloc__(self): cdef nvmlVgpuSchedulerParams_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -16959,7 +16959,7 @@ cdef class VgpuSchedulerSetParams: def __dealloc__(self): cdef nvmlVgpuSchedulerSetParams_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -17094,7 +17094,7 @@ cdef class VgpuLicenseInfo: def __dealloc__(self): cdef nvmlVgpuLicenseInfo_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -17440,7 +17440,7 @@ cdef class UnitFanSpeeds: def __dealloc__(self): cdef nvmlUnitFanSpeeds_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -17581,7 +17581,7 @@ cdef class VgpuPgpuMetadata: def __dealloc__(self): cdef nvmlVgpuPgpuMetadata_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -17779,7 +17779,7 @@ cdef class GpuInstanceInfo: def __dealloc__(self): cdef nvmlGpuInstanceInfo_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -17937,7 +17937,7 @@ cdef class ComputeInstanceInfo: def __dealloc__(self): cdef nvmlComputeInstanceInfo_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -18106,7 +18106,7 @@ cdef class EccSramUniqueUncorrectedErrorCounts_v1: def __dealloc__(self): cdef nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -18244,7 +18244,7 @@ cdef class NvlinkFirmwareInfo: def __dealloc__(self): cdef nvmlNvlinkFirmwareInfo_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -18384,7 +18384,7 @@ cdef class VgpuInstancesUtilizationInfo_v1: def __dealloc__(self): cdef nvmlVgpuInstancesUtilizationInfo_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -18548,7 +18548,7 @@ cdef class VgpuSchedulerLog: def __dealloc__(self): cdef nvmlVgpuSchedulerLog_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -18729,7 +18729,7 @@ cdef class VgpuSchedulerGetState: def __dealloc__(self): cdef nvmlVgpuSchedulerGetState_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -18876,7 +18876,7 @@ cdef class VgpuSchedulerStateInfo_v1: def __dealloc__(self): cdef nvmlVgpuSchedulerStateInfo_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -19047,7 +19047,7 @@ cdef class VgpuSchedulerLogInfo_v1: def __dealloc__(self): cdef nvmlVgpuSchedulerLogInfo_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -19241,7 +19241,7 @@ cdef class VgpuSchedulerState_v1: def __dealloc__(self): cdef nvmlVgpuSchedulerState_v1_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -19408,7 +19408,7 @@ cdef class GridLicensableFeatures: def __dealloc__(self): cdef nvmlGridLicensableFeatures_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr) @@ -19555,7 +19555,7 @@ cdef class NvLinkInfo_v2: def __dealloc__(self): cdef nvmlNvLinkInfo_v2_t *ptr - if self._owner is None and self._ptr != NULL: + if self._owned and self._ptr != NULL: ptr = self._ptr self._ptr = NULL free(ptr)