Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Handle the case for Multi-Instance GPUs when using cuda_visible_devices #1164

Merged
merged 8 commits into from
May 28, 2023
7 changes: 6 additions & 1 deletion mmengine/logging/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,12 @@ def _get_device_id():
cuda_visible_devices = list(range(num_device))
else:
cuda_visible_devices = cuda_visible_devices.split(',')
return int(cuda_visible_devices[local_rank])
if cuda_visible_devices[local_rank].isdigit():
return int(cuda_visible_devices[local_rank])
else:
# handle case for Multi-Instance GPUs
# see #1148 for details
return cuda_visible_devices[local_rank]


def _get_host_info() -> str:
Expand Down