@@ -38,11 +38,12 @@ def test_clk_mon_status_t():
3838 assert not hasattr (obj , "clk_mon_list_size" )
3939
4040
41- def test_current_clock_freqs (all_devices ):
41+ def test_current_clock_freqs (all_devices , subtests ):
4242 for device in all_devices :
43- with unsupported_before (device , None ):
44- clk_freqs = nvml .device_get_current_clock_freqs (device )
45- assert isinstance (clk_freqs , str )
43+ with subtests .test (device = device ):
44+ with unsupported_before (device , None ):
45+ clk_freqs = nvml .device_get_current_clock_freqs (device )
46+ assert isinstance (clk_freqs , str )
4647
4748
4849def test_grid_licensable_features (all_devices ):
@@ -69,17 +70,18 @@ def test_get_handle_by_uuidv(all_devices):
6970 assert new_handle == device
7071
7172
72- def test_get_nv_link_supported_bw_modes (all_devices ):
73+ def test_get_nv_link_supported_bw_modes (all_devices , subtests ):
7374 for device in all_devices :
74- with unsupported_before (device , None ):
75- modes = nvml .device_get_nvlink_supported_bw_modes (device )
76- assert isinstance (modes , nvml .NvlinkSupportedBwModes_v1 )
77- # #define NVML_NVLINK_TOTAL_SUPPORTED_BW_MODES 23
78- assert len (modes .bw_modes ) <= 23
79- assert not hasattr (modes , "total_bw_modes" )
75+ with subtests .test (device = device ):
76+ with unsupported_before (device , None ):
77+ modes = nvml .device_get_nvlink_supported_bw_modes (device )
78+ assert isinstance (modes , nvml .NvlinkSupportedBwModes_v1 )
79+ # #define NVML_NVLINK_TOTAL_SUPPORTED_BW_MODES 23
80+ assert len (modes .bw_modes ) <= 23
81+ assert not hasattr (modes , "total_bw_modes" )
8082
81- for mode in modes .bw_modes :
82- assert isinstance (mode , np .uint8 )
83+ for mode in modes .bw_modes :
84+ assert isinstance (mode , np .uint8 )
8385
8486
8587def test_device_get_pdi (all_devices ):
@@ -88,62 +90,67 @@ def test_device_get_pdi(all_devices):
8890 assert isinstance (pdi , int )
8991
9092
91- def test_device_get_performance_modes (all_devices ):
93+ def test_device_get_performance_modes (all_devices , subtests ):
9294 for device in all_devices :
93- with unsupported_before (device , None ):
94- modes = nvml .device_get_performance_modes (device )
95- assert isinstance (modes , str )
95+ with subtests .test (device = device ):
96+ with unsupported_before (device , None ):
97+ modes = nvml .device_get_performance_modes (device )
98+ assert isinstance (modes , str )
9699
97100
98101@pytest .mark .skipif (cuda_version_less_than (13010 ), reason = "Introduced in 13.1" )
99- def test_device_get_unrepairable_memory_flag (all_devices ):
102+ def test_device_get_unrepairable_memory_flag (all_devices , subtests ):
100103 for device in all_devices :
101- with unsupported_before (device , None ):
102- status = nvml .device_get_unrepairable_memory_flag_v1 (device )
103- assert isinstance (status , int )
104+ with subtests .test (device = device ):
105+ with unsupported_before (device , None ):
106+ status = nvml .device_get_unrepairable_memory_flag_v1 (device )
107+ assert isinstance (status , int )
104108
105109
106- def test_device_vgpu_get_heterogeneous_mode (all_devices ):
110+ def test_device_vgpu_get_heterogeneous_mode (all_devices , subtests ):
107111 for device in all_devices :
108- with unsupported_before (device , None ):
109- mode = nvml .device_get_vgpu_heterogeneous_mode (device )
110- assert isinstance (mode , int )
112+ with subtests .test (device = device ):
113+ with unsupported_before (device , None ):
114+ mode = nvml .device_get_vgpu_heterogeneous_mode (device )
115+ assert isinstance (mode , int )
111116
112117
113118@pytest .mark .skipif (cuda_version_less_than (13010 ), reason = "Introduced in 13.1" )
114- def test_read_prm_counters (all_devices ):
119+ def test_read_prm_counters (all_devices , subtests ):
115120 for device in all_devices :
116- counters = nvml .PRMCounter_v1 (5 )
117- with unsupported_before (device , None ):
118- read_counters = nvml .device_read_prm_counters_v1 (device , counters )
119- assert counters is read_counters
120- assert len (read_counters ) == 5
121+ with subtests .test (device = device ):
122+ counters = nvml .PRMCounter_v1 (5 )
123+ with unsupported_before (device , None ):
124+ read_counters = nvml .device_read_prm_counters_v1 (device , counters )
125+ assert counters is read_counters
126+ assert len (read_counters ) == 5
121127
122128
123129@pytest .mark .thread_unsafe (reason = "API appears to be thread-unsafe (2026-06)" )
124- def test_read_write_prm (all_devices ):
130+ def test_read_write_prm (all_devices , subtests ):
125131 for device in all_devices :
126- # Docs say supported in BLACKWELL or later
127- with unsupported_before (device , None ):
128- try :
129- result = nvml .device_read_write_prm_v1 (device , b"012345678" )
130- except nvml .NoPermissionError :
131- pytest .skip ("No permission to read/write PRM" )
132- assert isinstance (result , tuple )
133- assert isinstance (result [0 ], int )
134- assert isinstance (result [1 ], bytes )
135-
136-
137- def test_get_power_management_limit (all_devices ):
132+ with subtests .test (device = device ):
133+ # Docs say supported in BLACKWELL or later
134+ with unsupported_before (device , None ):
135+ try :
136+ result = nvml .device_read_write_prm_v1 (device , b"012345678" )
137+ except nvml .NoPermissionError :
138+ pytest .skip ("No permission to read/write PRM" )
139+ assert isinstance (result , tuple )
140+ assert isinstance (result [0 ], int )
141+ assert isinstance (result [1 ], bytes )
142+
143+
144+ def test_get_power_management_limit (all_devices , subtests ):
138145 for device in all_devices :
139146 # Docs say supported on KEPLER or later
140- with unsupported_before (device , None ):
147+ with subtests . test ( device = device ), unsupported_before (device , nvml . DeviceArch . KEPLER ):
141148 nvml .device_get_power_management_limit (device )
142149
143150
144- def test_set_power_management_limit (all_devices ):
151+ def test_set_power_management_limit (all_devices , subtests ):
145152 for device in all_devices :
146- with unsupported_before (device , nvml .DeviceArch .KEPLER ):
153+ with subtests . test ( device = device ), unsupported_before (device , nvml .DeviceArch .KEPLER ):
147154 try :
148155 nvml .device_set_power_management_limit_v2 (device , nvml .PowerScope .GPU , 10000 )
149156 except nvml .NoPermissionError :
@@ -152,18 +159,19 @@ def test_set_power_management_limit(all_devices):
152159 pytest .skip ("Invalid argument when setting power management limit -- probably unsupported" )
153160
154161
155- def test_set_temperature_threshold (all_devices ):
162+ def test_set_temperature_threshold (all_devices , subtests ):
156163 for device in all_devices :
157- # Docs say supported on MAXWELL or newer
158- with unsupported_before (device , None ):
159- temp = nvml .device_get_temperature_threshold (
160- device , nvml .TemperatureThresholds .TEMPERATURE_THRESHOLD_ACOUSTIC_CURR
161- )
162- try :
163- nvml .device_set_temperature_threshold (
164- device , nvml .TemperatureThresholds .TEMPERATURE_THRESHOLD_ACOUSTIC_CURR , temp
165- )
166- except nvml .NoPermissionError :
167- pytest .skip ("No permission to set temperature threshold" )
168- except nvml .InvalidArgumentError :
169- pytest .skip ("Invalid argument when setting temperature threshold -- this is probably the temp type" )
164+ with subtests .test (device = device ):
165+ # Docs say supported on MAXWELL or newer
166+ with unsupported_before (device , None ):
167+ temp = nvml .device_get_temperature_threshold (
168+ device , nvml .TemperatureThresholds .TEMPERATURE_THRESHOLD_ACOUSTIC_CURR
169+ )
170+ try :
171+ nvml .device_set_temperature_threshold (
172+ device , nvml .TemperatureThresholds .TEMPERATURE_THRESHOLD_ACOUSTIC_CURR , temp
173+ )
174+ except nvml .NoPermissionError :
175+ pytest .skip ("No permission to set temperature threshold" )
176+ except nvml .InvalidArgumentError :
177+ pytest .skip ("Invalid argument when setting temperature threshold -- this is probably the temp type" )
0 commit comments