@@ -386,21 +386,23 @@ def get_device_info(dev_index: int) -> _cu_device_info:
386
386
except KeyError :
387
387
pass
388
388
389
+ _init_nvml ()
390
+ if _nvml_lib is None :
391
+ return None
389
392
_init ()
390
393
if _init_pid is None :
391
394
return None
392
395
393
396
device = c_int ()
394
397
name_buf = create_string_buffer (100 )
395
- uuid_t = _CUuuid_t ()
396
398
cc_major = c_int ()
397
399
cc_minor = c_int ()
398
400
cores = c_int ()
399
401
threads_per_core = c_int ()
400
402
403
+ uuid_b = get_index_and_uuid (dev_index ).uuid
401
404
_cu_check_error (_cuda_lib .cuDeviceGet (byref (device ), c_int (dev_index )))
402
405
_cu_check_error (_cuda_lib .cuDeviceGetName (name_buf , len (name_buf ), device ))
403
- _cu_check_error (_cuda_lib .cuDeviceGetUuid (byref (uuid_t ), device ))
404
406
_cu_check_error (
405
407
_cuda_lib .cuDeviceComputeCapability (byref (cc_major ), byref (cc_minor ), device )
406
408
)
@@ -426,7 +428,7 @@ def get_device_info(dev_index: int) -> _cu_device_info:
426
428
427
429
info = _device_infos [dev_index ] = _cu_device_info (
428
430
index = real_dev_index ,
429
- uuid = uuid . UUID ( bytes = uuid_t . bytes ) ,
431
+ uuid = uuid_b ,
430
432
name = name_buf .value .decode (),
431
433
multiprocessors = cores .value ,
432
434
cuda_cores = cores .value
@@ -448,11 +450,9 @@ def get_device_status(dev_index: int) -> _nvml_device_status:
448
450
449
451
dev_uuid = get_device_info (dev_index ).uuid
450
452
451
- uuid_str = ("GPU-" + str (dev_uuid )).encode ()
452
-
453
453
if not _is_wsl :
454
454
_nvml_check_error (
455
- _nvml_lib .nvmlDeviceGetHandleByUUID (uuid_str , byref (c_device ))
455
+ _nvml_lib .nvmlDeviceGetHandleByUUID (dev_uuid , byref (c_device ))
456
456
)
457
457
458
458
_nvml_check_error (
0 commit comments