From 898f2c24bf055435cc33e4fda4147462f70e195c Mon Sep 17 00:00:00 2001 From: Peter Andreas Entschev Date: Wed, 15 Feb 2023 02:32:40 -0800 Subject: [PATCH 1/2] Fix for bytes/str discrepancy after PyNVML update --- dask_cuda/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dask_cuda/utils.py b/dask_cuda/utils.py index 1a24d80b0..5e558fbc5 100644 --- a/dask_cuda/utils.py +++ b/dask_cuda/utils.py @@ -676,7 +676,10 @@ def get_gpu_uuid_from_index(device_index=0): pynvml.nvmlInit() handle = pynvml.nvmlDeviceGetHandleByIndex(device_index) - return pynvml.nvmlDeviceGetUUID(handle).decode("utf-8") + try: + return pynvml.nvmlDeviceGetUUID(handle).decode("utf-8") + except AttributeError: + return pynvml.nvmlDeviceGetUUID(handle) def get_worker_config(dask_worker): From 01d6eae662da0a8e3c4895425b07edf3eb99f80e Mon Sep 17 00:00:00 2001 From: Peter Andreas Entschev Date: Wed, 15 Feb 2023 02:44:08 -0800 Subject: [PATCH 2/2] Fix `test_parse_visible_devices` --- dask_cuda/tests/test_utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dask_cuda/tests/test_utils.py b/dask_cuda/tests/test_utils.py index ca17c097c..34e63f1b4 100644 --- a/dask_cuda/tests/test_utils.py +++ b/dask_cuda/tests/test_utils.py @@ -189,13 +189,16 @@ def test_parse_visible_devices(): uuids = [] for index in range(get_gpu_count()): handle = pynvml.nvmlDeviceGetHandleByIndex(index) - uuid = pynvml.nvmlDeviceGetUUID(handle).decode("utf-8") + try: + uuid = pynvml.nvmlDeviceGetUUID(handle).decode("utf-8") + except AttributeError: + uuid = pynvml.nvmlDeviceGetUUID(handle) assert parse_cuda_visible_device(index) == index assert parse_cuda_visible_device(uuid) == uuid indices.append(str(index)) - uuids.append(pynvml.nvmlDeviceGetUUID(handle).decode("utf-8")) + uuids.append(uuid) index_devices = ",".join(indices) with patch.dict(os.environ, {"CUDA_VISIBLE_DEVICES": index_devices}):