Coverage for cuda/core/system/typing.py: 0.00%

165 statements  

« prev     ^ index     » next       coverage.py v7.16.2, created at 2026-10-16 01:23 +0000

1# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 

2# 

3# SPDX-License-Identifier: Apache-2.0 

4 

5from enum import StrEnum 

6 

7from cuda.bindings import nvml as _nvml 

8from cuda.bindings._internal._fast_enum import FastEnum as _FastEnum 

9 

10__all__ = [ 

11 "AddressingMode", 

12 "AffinityScope", 

13 "ClockId", 

14 "ClockType", 

15 "ClocksEventReasons", 

16 "CoolerControl", 

17 "CoolerTarget", 

18 "DeviceArch", 

19 "EventType", 

20 "FanControlPolicy", 

21 "FieldId", 

22 "GpuP2PCapsIndex", 

23 "GpuP2PStatus", 

24 "GpuTopologyLevel", 

25 "InforomObject", 

26 "SystemEventType", 

27 "TemperatureThresholds", 

28 "ThermalController", 

29 "ThermalTarget", 

30] 

31 

32 

33class AddressingMode(StrEnum): 

34 """ 

35 Addressing mode of a device. 

36 

37 For Kepler™ or newer fully supported devices. 

38 """ 

39 

40 HMM = "hmm" 

41 ATS = "ats" 

42 

43 

44AddressingMode.HMM.__doc__ = """ 

45 System allocated memory (``malloc``, ``mmap``) is addressable from the device 

46 (GPU), via software-based mirroring of the CPU's page tables, on the GPU. 

47""" 

48 

49AddressingMode.ATS.__doc__ = """ 

50 System allocated memory (``malloc``, ``mmap``) is addressable from the device 

51 (GPU), via Address Translation Services. This means that there is (effectively) 

52 a single set of page tables, and the CPU and GPU both use them. 

53""" 

54 

55 

56class AffinityScope(StrEnum): 

57 """ 

58 Scope for affinity queries. 

59 """ 

60 

61 NODE = "node" 

62 SOCKET = "socket" 

63 

64 

65AffinityScope.NODE.__doc__ = """ 

66The NUMA node is the scope of the affinity query. This is the default scope. 

67""" 

68 

69AffinityScope.SOCKET.__doc__ = """ 

70The CPU socket is the scope of the affinity query. 

71""" 

72 

73 

74class ClockId(StrEnum): 

75 """ 

76 Clock Ids. These are used in combination with :class:`ClockType` to specify a single clock value. 

77 """ 

78 

79 CURRENT = "current" 

80 CUSTOMER_BOOST_MAX = "customer_boost_max" 

81 # APP_CLOCK_TARGET and APP_CLOCK_DEFAULT are deprecated so not included here 

82 

83 

84ClockId.CURRENT.__doc__ = "Current actual clock value." 

85ClockId.CUSTOMER_BOOST_MAX.__doc__ = "OEM-defined maximum clock rate" 

86 

87 

88class ClocksEventReasons(StrEnum): 

89 """ 

90 Reasons for a clocks event. These are used in combination with :class:`ClockType` to specify the reason 

91 for a clocks event. 

92 """ 

93 

94 NONE = "none" 

95 GPU_IDLE = "gpu_idle" 

96 APPLICATIONS_CLOCKS_SETTING = "applications_clocks_setting" 

97 SW_POWER_CAP = "sw_power_cap" 

98 HW_SLOWDOWN = "hw_slowdown" 

99 SYNC_BOOST = "sync_boost" 

100 SW_THERMAL_SLOWDOWN = "sw_thermal_slowdown" 

101 HW_THERMAL_SLOWDOWN = "hw_thermal_slowdown" 

102 HW_POWER_BRAKE_SLOWDOWN = "hw_power_brake_slowdown" 

103 DISPLAY_CLOCK_SETTING = "display_clock_setting" 

104 BOARD_LIMIT = "board_limit" 

105 RELIABILITY = "reliability" 

106 

107 

108class ClockType(StrEnum): 

109 """ 

110 Clock types. All speeds are in Mhz. 

111 """ 

112 

113 GRAPHICS = "graphics" 

114 SM = "sm" 

115 MEMORY = "memory" 

116 VIDEO = "video" 

117 

118 

119class CoolerControl(StrEnum): 

120 """ 

121 Cooler control type. 

122 """ 

123 

124 TOGGLE = "toggle" 

125 VARIABLE = "variable" 

126 

127 

128CoolerControl.TOGGLE.__doc__ = """ 

129This cooler can only be toggled either ON or OFF (e.g. a switch). 

130""" 

131 

132CoolerControl.VARIABLE.__doc__ = """ 

133This cooler's level can be adjusted from some minimum to some maximum (e.g. a knob). 

134""" 

135 

136 

137class CoolerTarget(StrEnum): 

138 """ 

139 Cooler target. 

140 """ 

141 

142 NONE = "none" 

143 GPU = "gpu" 

144 MEMORY = "memory" 

145 POWER_SUPPLY = "power_supply" 

146 # THERMAL_GPU_RELATED is a composite target, so it is omitted here and will 

147 # get returned as 3 separate targets: GPU, MEMORY, and POWER_SUPPLY. 

148 

149 

150CoolerTarget.NONE.__doc__ = "This cooler controls nothing." 

151CoolerTarget.GPU.__doc__ = "This cooler can cool the GPU." 

152CoolerTarget.MEMORY.__doc__ = "This cooler can cool the memory." 

153CoolerTarget.POWER_SUPPLY.__doc__ = "This cooler can cool the power supply." 

154 

155 

156class EventType(StrEnum): 

157 """ 

158 Event types that can be waited on with :class:`DeviceEvents`. 

159 """ 

160 

161 NONE = "none" 

162 SINGLE_BIT_ECC_ERROR = "single_bit_ecc_error" 

163 DOUBLE_BIT_ECC_ERROR = "double_bit_ecc_error" 

164 PSTATE = "pstate" 

165 XID_CRITICAL_ERROR = "xid_critical_error" 

166 CLOCK = "clock" 

167 POWER_SOURCE_CHANGE = "power_source_change" 

168 MIG_CONFIG_CHANGE = "mig_config_change" 

169 SINGLE_BIT_ECC_ERROR_STORM = "single_bit_ecc_error_storm" 

170 DRAM_RETIREMENT_EVENT = "dram_retirement_event" 

171 DRAM_RETIREMENT_FAILURE = "dram_retirement_failure" 

172 NON_FATAL_POISON_ERROR = "non_fatal_poison_error" 

173 FATAL_POISON_ERROR = "fatal_poison_error" 

174 GPU_UNAVAILABLE_ERROR = "gpu_unavailable_error" 

175 GPU_RECOVERY_ACTION = "gpu_recovery_action" 

176 

177 

178EventType.PSTATE.__doc__ = """ 

179Event about PState changes 

180 

181On Fermi™ architecture, PState changes are also an indicator that GPU is throttling down due to 

182no work being executed on the GPU, power capping or thermal capping. In a typical situation, 

183Fermi-based GPU should stay in P0 for the duration of the execution of the compute process. 

184""" 

185 

186 

187class FanControlPolicy(StrEnum): 

188 """ 

189 Fan control policies. 

190 """ 

191 

192 TEMPERATURE_CONTROLLED = "temperature_controlled" 

193 MANUAL = "manual" 

194 

195 

196class GpuP2PCapsIndex(StrEnum): 

197 """ 

198 GPU peer-to-peer capabilities index. 

199 """ 

200 

201 READ = "read" 

202 WRITE = "write" 

203 NVLINK = "nvlink" 

204 ATOMICS = "atomics" 

205 PCI = "pci" 

206 PROP = "prop" 

207 UNKNOWN = "unknown" 

208 

209 

210class GpuP2PStatus(StrEnum): 

211 """ 

212 GPU peer-to-peer status. 

213 """ 

214 

215 OK = "ok" 

216 CHIPSET_NOT_SUPPORTED = "chipset not supported" 

217 GPU_NOT_SUPPORTED = "GPU not supported" 

218 IOH_TOPOLOGY_NOT_SUPPORTED = "IOH topology not supported" 

219 DISABLED_BY_REGKEY = "disabled by regkey" 

220 NOT_SUPPORTED = "not supported" 

221 UNKNOWN = "unknown" 

222 

223 

224class GpuTopologyLevel(StrEnum): 

225 """ 

226 Represents level relationships within a system between two GPUs. 

227 """ 

228 

229 INTERNAL = "internal" 

230 SINGLE = "single" 

231 MULTIPLE = "multiple" 

232 HOSTBRIDGE = "hostbridge" 

233 NODE = "node" 

234 SYSTEM = "system" 

235 

236 

237class InforomObject(StrEnum): 

238 """ 

239 InfoROM objects types. 

240 """ 

241 

242 OEM = "oem" 

243 ECC = "ecc" 

244 POWER = "power" 

245 DEN = "den" 

246 

247 

248InforomObject.OEM.__doc__ = "An object defined by OEM." 

249InforomObject.ECC.__doc__ = "The ECC object determining the level of ECC support." 

250InforomObject.POWER.__doc__ = "The power management object." 

251InforomObject.DEN.__doc__ = "DRAM Encryption object." 

252 

253 

254class SystemEventType(StrEnum): 

255 """ 

256 System event types. 

257 """ 

258 

259 UNBIND = "unbind" 

260 BIND = "bind" 

261 

262 

263class TemperatureThresholds(StrEnum): 

264 """ 

265 Temperature threshold types. 

266 """ 

267 

268 SHUTDOWN = "shutdown" 

269 SLOWDOWN = "slowdown" 

270 MEM_MAX = "mem_max" 

271 GPU_MAX = "gpu_max" 

272 ACOUSTIC_MIN = "acoustic_min" 

273 ACOUSTIC_CURR = "acoustic_curr" 

274 ACOUSTIC_MAX = "acoustic_max" 

275 GPS_CURR = "gps_curr" 

276 

277 

278class ThermalController(StrEnum): 

279 """ 

280 Thermal controller types. 

281 """ 

282 

283 GPU_INTERNAL = "gpu_internal" 

284 ADM1032 = "adm1032" 

285 ADT7461 = "adt7461" 

286 MAX6649 = "max6649" 

287 MAX1617 = "max1617" 

288 LM99 = "lm99" 

289 LM89 = "lm89" 

290 LM64 = "lm64" 

291 G781 = "g781" 

292 ADT7473 = "adt7473" 

293 SBMAX6649 = "sbmax6649" 

294 VBIOSEVT = "vbiosevt" 

295 OS = "os" 

296 NVSYSCON_CANOAS = "nvsyscon_canoas" 

297 NVSYSCON_E551 = "nvsyscon_e551" 

298 MAX6649R = "max6649r" 

299 ADT7473S = "adt7473s" 

300 UNKNOWN = "unknown" 

301 

302 

303class ThermalTarget(StrEnum): 

304 """ 

305 Thermal sensor targets. 

306 """ 

307 

308 NONE = "none" 

309 GPU = "gpu" 

310 MEMORY = "memory" 

311 POWER_SUPPLY = "power_supply" 

312 BOARD = "board" 

313 VCD_BOARD = "vcd_board" 

314 VCD_INLET = "vcd_inlet" 

315 VCD_OUTLET = "vcd_outlet" 

316 ALL = "all" 

317 

318 

319ThermalTarget.GPU.__doc__ = "GPU core temperature requires physical GPU handle." 

320ThermalTarget.MEMORY.__doc__ = "GPU memory temperature requires physical GPU handle." 

321ThermalTarget.POWER_SUPPLY.__doc__ = "GPU power supply temperature requires physical GPU handle." 

322ThermalTarget.BOARD.__doc__ = "GPU board ambient temperature requires physical GPU handle." 

323ThermalTarget.VCD_BOARD.__doc__ = "Visual Computing Device Board temperature requires visual computing device handle." 

324ThermalTarget.VCD_INLET.__doc__ = "Visual Computing Device Inlet temperature requires visual computing device handle." 

325ThermalTarget.VCD_OUTLET.__doc__ = "Visual Computing Device Outlet temperature requires visual computing device handle." 

326 

327 

328# DeviceArch takes its values from cuda.bindings.nvml at definition time. 

329# It is a FastEnum (an int) rather than a StrEnum because the order of the 

330# values is meaningful, e.g. Kepler "or later". 

331class DeviceArch(_FastEnum): 

332 """ 

333 Device architecture. 

334 """ 

335 

336 KEPLER = int(_nvml.DeviceArch.KEPLER) 

337 MAXWELL = int(_nvml.DeviceArch.MAXWELL) 

338 PASCAL = int(_nvml.DeviceArch.PASCAL) 

339 VOLTA = int(_nvml.DeviceArch.VOLTA) 

340 TURING = int(_nvml.DeviceArch.TURING) 

341 AMPERE = int(_nvml.DeviceArch.AMPERE) 

342 ADA = int(_nvml.DeviceArch.ADA) 

343 HOPPER = int(_nvml.DeviceArch.HOPPER) 

344 BLACKWELL = int(_nvml.DeviceArch.BLACKWELL) 

345 UNKNOWN = int(_nvml.DeviceArch.UNKNOWN) 

346 

347 

348FieldId = _nvml.FieldId 

349 

350del _nvml 

351 

352 

353del StrEnum