Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bf2e838

Browse files
committedFeb 3, 2025·
fix test bug
1 parent b522b91 commit bf2e838

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed
 

‎cuda_core/tests/test_device.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,15 @@ def test_compute_capability():
188188
("gpu_direct_rdma_writes_ordering", int),
189189
("mempool_supported_handle_types", int),
190190
("deferred_mapping_cuda_array_supported", bool),
191-
("numa_config", int),
192-
("numa_id", int),
193-
("multicast_supported", bool),
194191
]
195192

193+
cuda_12_properties = [("numa_config", int), ("numa_id", int), ("multicast_supported", bool)]
194+
195+
cuda_11 = True
196+
if runtime.cudaRuntimeGetVersion() >= (12, 0):
197+
cuda_base_properties += cuda_12_properties
198+
cuda_11 = False
199+
196200

197201
@pytest.mark.parametrize("property_name, expected_type", cuda_base_properties)
198202
def test_device_property_types(property_name, expected_type):
@@ -204,5 +208,12 @@ def test_device_properties_complete():
204208
device = Device()
205209
live_props = set(attr for attr in dir(device.properties) if not attr.startswith("_"))
206210
tab_props = set(attr for attr, _ in cuda_base_properties)
207-
assert len(tab_props) == len(cuda_base_properties) # Ensure no duplicates.
208-
assert tab_props == live_props # Ensure exact match.
211+
212+
# Exclude specific properties from the comparison when unsupported by CTK.
213+
excluded_props = {"numa_config", "multicast_supported", "numa_id"} if cuda_11 else set()
214+
215+
filtered_tab_props = tab_props - excluded_props
216+
filtered_live_props = live_props - excluded_props
217+
218+
assert len(filtered_tab_props) == len(cuda_base_properties) # Ensure no duplicates.
219+
assert filtered_tab_props == filtered_live_props # Ensure exact match.

0 commit comments

Comments
 (0)
Please sign in to comment.