Skip to content

Commit 20c8a7a

Browse files
rwgkcursoragent
andcommitted
test: simplify MCDM helper device lookup
Use getattr for the shared mempool helper so it accepts device objects and raw ordinals without extra branching. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 4517648 commit 20c8a7a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • cuda_bindings/cuda/bindings/_test_helpers

cuda_bindings/cuda/bindings/_test_helpers/mempool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def is_windows_mcdm_device(device=0):
1313
return False
1414
import cuda.bindings.nvml as nvml
1515

16-
device_id = int(device.device_id if hasattr(device, "device_id") else device)
16+
device_id = int(getattr(device, "device_id", device))
1717
(err,) = driver.cuInit(0)
1818
if err != driver.CUresult.CUDA_SUCCESS:
1919
return False

0 commit comments

Comments
 (0)