use crate::error::NvmlError;
use crate::ffi::bindings::*;
#[cfg(feature = "serde")]
use serde_derive::{Deserialize, Serialize};
use wrapcenum_derive::EnumWrapper;
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlRestrictedAPI_enum")]
pub enum Api {
#[wrap(c_variant = "NVML_RESTRICTED_API_SET_APPLICATION_CLOCKS")]
ApplicationClocks,
#[wrap(c_variant = "NVML_RESTRICTED_API_SET_AUTO_BOOSTED_CLOCKS")]
AutoBoostedClocks,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlClockType_enum")]
pub enum Clock {
#[wrap(c_variant = "NVML_CLOCK_GRAPHICS")]
Graphics,
#[wrap(c_variant = "NVML_CLOCK_SM")]
SM,
#[wrap(c_variant = "NVML_CLOCK_MEM")]
Memory,
#[wrap(c_variant = "NVML_CLOCK_VIDEO")]
Video,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlClockId_enum")]
pub enum ClockId {
#[wrap(c_variant = "NVML_CLOCK_ID_CURRENT")]
Current,
#[wrap(c_variant = "NVML_CLOCK_ID_APP_CLOCK_TARGET")]
TargetAppClock,
#[wrap(c_variant = "NVML_CLOCK_ID_APP_CLOCK_DEFAULT")]
DefaultAppClock,
#[wrap(c_variant = "NVML_CLOCK_ID_CUSTOMER_BOOST_MAX")]
CustomerMaxBoost,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlBrandType_enum")]
pub enum Brand {
#[wrap(c_variant = "NVML_BRAND_UNKNOWN")]
Unknown,
#[wrap(c_variant = "NVML_BRAND_QUADRO")]
Quadro,
#[wrap(c_variant = "NVML_BRAND_TESLA")]
Tesla,
#[wrap(c_variant = "NVML_BRAND_NVS")]
NVS,
#[wrap(c_variant = "NVML_BRAND_GRID")]
GRID,
#[wrap(c_variant = "NVML_BRAND_GEFORCE")]
GeForce,
#[wrap(c_variant = "NVML_BRAND_TITAN")]
Titan,
#[wrap(c_variant = "NVML_BRAND_NVIDIA_VAPPS")]
VApps,
#[wrap(c_variant = "NVML_BRAND_NVIDIA_VPC")]
VPC,
#[wrap(c_variant = "NVML_BRAND_NVIDIA_VCS")]
VCS,
#[wrap(c_variant = "NVML_BRAND_NVIDIA_VWS")]
VWS,
#[wrap(c_variant = "NVML_BRAND_NVIDIA_CLOUD_GAMING")]
CloudGaming,
#[wrap(c_variant = "NVML_BRAND_NVIDIA_VGAMING")]
VGaming,
#[wrap(c_variant = "NVML_BRAND_QUADRO_RTX")]
QuadroRTX,
#[wrap(c_variant = "NVML_BRAND_NVIDIA_RTX")]
NvidiaRTX,
#[wrap(c_variant = "NVML_BRAND_NVIDIA")]
Nvidia,
#[wrap(c_variant = "NVML_BRAND_GEFORCE_RTX")]
GeForceRTX,
#[wrap(c_variant = "NVML_BRAND_TITAN_RTX")]
TitanRTX,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlBridgeChipType_enum")]
pub enum BridgeChip {
#[wrap(c_variant = "NVML_BRIDGE_CHIP_PLX")]
PLX,
#[wrap(c_variant = "NVML_BRIDGE_CHIP_BRO4")]
BRO4,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlMemoryErrorType_enum")]
pub enum MemoryError {
#[wrap(c_variant = "NVML_MEMORY_ERROR_TYPE_CORRECTED")]
Corrected,
#[wrap(c_variant = "NVML_MEMORY_ERROR_TYPE_UNCORRECTED")]
Uncorrected,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlEccCounterType_enum")]
pub enum EccCounter {
#[wrap(c_variant = "NVML_VOLATILE_ECC")]
Volatile,
#[wrap(c_variant = "NVML_AGGREGATE_ECC")]
Aggregate,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlMemoryLocation_enum")]
pub enum MemoryLocation {
#[wrap(c_variant = "NVML_MEMORY_LOCATION_L1_CACHE")]
L1Cache,
#[wrap(c_variant = "NVML_MEMORY_LOCATION_L2_CACHE")]
L2Cache,
#[wrap(c_variant = "NVML_MEMORY_LOCATION_DEVICE_MEMORY")]
Device,
#[wrap(c_variant = "NVML_MEMORY_LOCATION_REGISTER_FILE")]
RegisterFile,
#[wrap(c_variant = "NVML_MEMORY_LOCATION_TEXTURE_MEMORY")]
Texture,
#[wrap(c_variant = "NVML_MEMORY_LOCATION_TEXTURE_SHM")]
Shared,
#[wrap(c_variant = "NVML_MEMORY_LOCATION_CBU")]
Cbu,
#[wrap(c_variant = "NVML_MEMORY_LOCATION_SRAM")]
SRAM,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlDriverModel_enum")]
#[cfg(target_os = "windows")]
pub enum DriverModel {
#[wrap(c_variant = "NVML_DRIVER_WDDM")]
WDDM,
#[wrap(c_variant = "NVML_DRIVER_WDM")]
WDM,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlGom_enum")]
pub enum OperationMode {
#[wrap(c_variant = "NVML_GOM_ALL_ON")]
AllOn,
#[wrap(c_variant = "NVML_GOM_COMPUTE")]
Compute,
#[wrap(c_variant = "NVML_GOM_LOW_DP")]
LowDP,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlInforomObject_enum")]
pub enum InfoRom {
#[wrap(c_variant = "NVML_INFOROM_OEM")]
OEM,
#[wrap(c_variant = "NVML_INFOROM_ECC")]
ECC,
#[wrap(c_variant = "NVML_INFOROM_POWER")]
Power,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlPcieUtilCounter_enum")]
pub enum PcieUtilCounter {
#[wrap(c_variant = "NVML_PCIE_UTIL_TX_BYTES")]
Send,
#[wrap(c_variant = "NVML_PCIE_UTIL_RX_BYTES")]
Receive,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlPStates_enum")]
pub enum PerformanceState {
#[wrap(c_variant = "NVML_PSTATE_0")]
Zero,
#[wrap(c_variant = "NVML_PSTATE_1")]
One,
#[wrap(c_variant = "NVML_PSTATE_2")]
Two,
#[wrap(c_variant = "NVML_PSTATE_3")]
Three,
#[wrap(c_variant = "NVML_PSTATE_4")]
Four,
#[wrap(c_variant = "NVML_PSTATE_5")]
Five,
#[wrap(c_variant = "NVML_PSTATE_6")]
Six,
#[wrap(c_variant = "NVML_PSTATE_7")]
Seven,
#[wrap(c_variant = "NVML_PSTATE_8")]
Eight,
#[wrap(c_variant = "NVML_PSTATE_9")]
Nine,
#[wrap(c_variant = "NVML_PSTATE_10")]
Ten,
#[wrap(c_variant = "NVML_PSTATE_11")]
Eleven,
#[wrap(c_variant = "NVML_PSTATE_12")]
Twelve,
#[wrap(c_variant = "NVML_PSTATE_13")]
Thirteen,
#[wrap(c_variant = "NVML_PSTATE_14")]
Fourteen,
#[wrap(c_variant = "NVML_PSTATE_15")]
Fifteen,
#[wrap(c_variant = "NVML_PSTATE_UNKNOWN")]
Unknown,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlPageRetirementCause_enum")]
pub enum RetirementCause {
#[wrap(c_variant = "NVML_PAGE_RETIREMENT_CAUSE_MULTIPLE_SINGLE_BIT_ECC_ERRORS")]
MultipleSingleBitEccErrors,
#[wrap(c_variant = "NVML_PAGE_RETIREMENT_CAUSE_DOUBLE_BIT_ECC_ERROR")]
DoubleBitEccError,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlSamplingType_enum")]
pub enum Sampling {
#[wrap(c_variant = "NVML_TOTAL_POWER_SAMPLES")]
Power,
#[wrap(c_variant = "NVML_GPU_UTILIZATION_SAMPLES")]
GpuUtilization,
#[wrap(c_variant = "NVML_MEMORY_UTILIZATION_SAMPLES")]
MemoryUtilization,
#[wrap(c_variant = "NVML_ENC_UTILIZATION_SAMPLES")]
EncoderUtilization,
#[wrap(c_variant = "NVML_DEC_UTILIZATION_SAMPLES")]
DecoderUtilization,
#[wrap(c_variant = "NVML_PROCESSOR_CLK_SAMPLES")]
ProcessorClock,
#[wrap(c_variant = "NVML_MEMORY_CLK_SAMPLES")]
MemoryClock,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlTemperatureSensors_enum")]
pub enum TemperatureSensor {
#[wrap(c_variant = "NVML_TEMPERATURE_GPU")]
Gpu,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlTemperatureThresholds_enum")]
pub enum TemperatureThreshold {
#[wrap(c_variant = "NVML_TEMPERATURE_THRESHOLD_SHUTDOWN")]
Shutdown,
#[wrap(c_variant = "NVML_TEMPERATURE_THRESHOLD_SLOWDOWN")]
Slowdown,
#[wrap(c_variant = "NVML_TEMPERATURE_THRESHOLD_MEM_MAX")]
MemoryMax,
#[wrap(c_variant = "NVML_TEMPERATURE_THRESHOLD_GPU_MAX")]
GpuMax,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlGpuLevel_enum")]
pub enum TopologyLevel {
#[wrap(c_variant = "NVML_TOPOLOGY_INTERNAL")]
Internal,
#[wrap(c_variant = "NVML_TOPOLOGY_SINGLE")]
Single,
#[wrap(c_variant = "NVML_TOPOLOGY_MULTIPLE")]
Multiple,
#[wrap(c_variant = "NVML_TOPOLOGY_HOSTBRIDGE")]
HostBridge,
#[wrap(c_variant = "NVML_TOPOLOGY_NODE")]
Node,
#[wrap(c_variant = "NVML_TOPOLOGY_SYSTEM")]
System,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlPerfPolicyType_enum")]
pub enum PerformancePolicy {
#[wrap(c_variant = "NVML_PERF_POLICY_POWER")]
Power,
#[wrap(c_variant = "NVML_PERF_POLICY_THERMAL")]
Thermal,
#[wrap(c_variant = "NVML_PERF_POLICY_SYNC_BOOST")]
SyncBoost,
#[wrap(c_variant = "NVML_PERF_POLICY_BOARD_LIMIT")]
BoardLimit,
#[wrap(c_variant = "NVML_PERF_POLICY_LOW_UTILIZATION")]
LowUtilization,
#[wrap(c_variant = "NVML_PERF_POLICY_RELIABILITY")]
Reliability,
#[wrap(c_variant = "NVML_PERF_POLICY_TOTAL_APP_CLOCKS")]
TotalAppClocks,
#[wrap(c_variant = "NVML_PERF_POLICY_TOTAL_BASE_CLOCKS")]
TotalBaseClocks,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlComputeMode_enum")]
pub enum ComputeMode {
#[wrap(c_variant = "NVML_COMPUTEMODE_DEFAULT")]
Default,
#[wrap(c_variant = "NVML_COMPUTEMODE_EXCLUSIVE_THREAD")]
ExclusiveThread,
#[wrap(c_variant = "NVML_COMPUTEMODE_PROHIBITED")]
Prohibited,
#[wrap(c_variant = "NVML_COMPUTEMODE_EXCLUSIVE_PROCESS")]
ExclusiveProcess,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlGpuP2PStatus_enum")]
pub enum P2pStatus {
#[wrap(c_variant = "NVML_P2P_STATUS_OK")]
Ok,
#[wrap(c_variant = "NVML_P2P_STATUS_CHIPSET_NOT_SUPPORED")]
ChipsetNotSupported,
#[wrap(c_variant = "NVML_P2P_STATUS_GPU_NOT_SUPPORTED")]
GpuNotSupported,
#[wrap(c_variant = "NVML_P2P_STATUS_IOH_TOPOLOGY_NOT_SUPPORTED")]
IohTopologyNotSupported,
#[wrap(c_variant = "NVML_P2P_STATUS_DISABLED_BY_REGKEY")]
DisabledByRegkey,
#[wrap(c_variant = "NVML_P2P_STATUS_NOT_SUPPORTED")]
NotSupported,
#[wrap(c_variant = "NVML_P2P_STATUS_UNKNOWN")]
Unknown,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlGpuP2PCapsIndex_enum")]
pub enum P2pCapabilitiesIndex {
#[wrap(c_variant = "NVML_P2P_CAPS_INDEX_READ")]
Read,
#[wrap(c_variant = "NVML_P2P_CAPS_INDEX_WRITE")]
Write,
#[wrap(c_variant = "NVML_P2P_CAPS_INDEX_NVLINK")]
NvLink,
#[wrap(c_variant = "NVML_P2P_CAPS_INDEX_ATOMICS")]
Atomics,
#[wrap(c_variant = "NVML_P2P_CAPS_INDEX_PROP")]
Prop,
#[wrap(c_variant = "NVML_P2P_CAPS_INDEX_UNKNOWN")]
Unknown,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlValueType_enum")]
pub enum SampleValueType {
#[wrap(c_variant = "NVML_VALUE_TYPE_DOUBLE")]
Double,
#[wrap(c_variant = "NVML_VALUE_TYPE_UNSIGNED_INT")]
UnsignedInt,
#[wrap(c_variant = "NVML_VALUE_TYPE_UNSIGNED_LONG")]
UnsignedLong,
#[wrap(c_variant = "NVML_VALUE_TYPE_UNSIGNED_LONG_LONG")]
UnsignedLongLong,
#[wrap(c_variant = "NVML_VALUE_TYPE_SIGNED_LONG_LONG")]
SignedLongLong,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlEncoderQueryType_enum")]
pub enum EncoderType {
#[wrap(c_variant = "NVML_ENCODER_QUERY_H264")]
H264,
#[wrap(c_variant = "NVML_ENCODER_QUERY_HEVC")]
HEVC,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlFBCSessionType_enum")]
pub enum FbcSessionType {
#[wrap(c_variant = "NVML_FBC_SESSION_TYPE_UNKNOWN")]
Unknown,
#[wrap(c_variant = "NVML_FBC_SESSION_TYPE_TOSYS")]
ToSys,
#[wrap(c_variant = "NVML_FBC_SESSION_TYPE_CUDA")]
Cuda,
#[wrap(c_variant = "NVML_FBC_SESSION_TYPE_VID")]
Vid,
#[wrap(c_variant = "NVML_FBC_SESSION_TYPE_HWENC")]
HwEnc,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlDetachGpuState_enum")]
pub enum DetachGpuState {
#[wrap(c_variant = "NVML_DETACH_GPU_KEEP")]
Keep,
#[wrap(c_variant = "NVML_DETACH_GPU_REMOVE")]
Remove,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlPcieLinkState_enum")]
pub enum PcieLinkState {
#[wrap(c_variant = "NVML_PCIE_LINK_KEEP")]
Keep,
#[wrap(c_variant = "NVML_PCIE_LINK_SHUT_DOWN")]
ShutDown,
}
#[derive(EnumWrapper, Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlClockLimitId_enum")]
pub enum ClockLimitId {
#[wrap(c_variant = "NVML_CLOCK_LIMIT_ID_TDP")]
Tdp,
#[wrap(c_variant = "NVML_CLOCK_LIMIT_ID_UNLIMITED")]
Unlimited,
}